Oracle API


Module:ORA.NLM
Purpose:Retrieve the Oracle error message.
Syntax:<sMessage>=ORA:Error:Message
Description:Retrieves the Oracle error message for the last error that occured.
Outputs:String
See Also:SYS:Error:Number
Example:Handle = ORA:Logon(UserName, Password)
Error = SYS:ERROR:NUMBER
If (ERROR !=0)
Print("Error (",Data:String(Error),")logging on to Oracle as
",UserName);Newline
Msg = Ora:Error:message(Error)
Print(Msg);newline
return
endif

Go to Table of Contents

ORA:Field:First

Module:ORA.NLM
Purpose:Gets the first field name from a query.
Syntax:<sFieldName>=ORA:Field:First
Description:Gets the first field name from a query.
Outputs:String
See Also:ORA:Field:Next
Example:Buffer = ORA:Field:First
Do While (STR:Length(Buffer)>0)
Buffer =ORA:Field:Next
EnDo

Go to Table of Contents

ORA:Field:Get

Module:ORA.NLM
Purpose:Retrieve the value of a field.
Syntax:<xValue>=ORA:Field:Get(<sFieldName>)
Description:Retrieve the value of a field.
Outputs:Any Type
See Also:ORA:REcord:Get
Example:Ename = ORA:Field:Get("ename")

Go to Table of Contents

ORA:Field:Max

Module:ORA.NLM
Purpose:Change the default field size maximum.
Syntax:<lSuccess>=ORA:Field:Max(<iMaxLength>)
Description:Changes the default maximum field size that is returned to <iMaxLength>. The initial maximum field size is 64.
Outputs:Logical
See Also:**
Example:Success = ORA:Field:Max(5)

Go to Table of Contents

ORA:Field:Next

Module:ORA.NLM
Purpose:Gets the next field names from a query.
Syntax:<sFieldName>=ORA:Field:Next
Description:Gets the next field names from a query.
Outputs:String
See Also:ORA:Field:First
Example:Buffer = ORA:Field:First
Do While (STR:Length(Buffer)>0)
Buffer =ORA:Field:Next
EnDo

Go to Table of Contents

ORA:Field:Size

Module:ORA.NLM
Purpose:Returns the field size of the current field.
Syntax:<iSize>=ORA:Field:Size
Description:Returns the field size of the current field.
Outputs:Integer
See Also:**
Example:Size = ORA:Field:Size

Go to Table of Contents

ORA:Field:Type

Module:ORA.NLM
Purpose:Gets the field type.
Syntax:<sType>=ORA:Field:Type
Description:Gets the field type.
Outputs:String
See Also:**
Example:Type = ORA:Field:Type

Go to Table of Contents

ORA:Logoff

Module:ORA.NLM
Purpose:Logs out of Oracle.
Syntax:<lSuccess>=ORA:Logoff(<hHandle>)
Description:Disconnects a login data area from the Oracle program global area and frees all Oracle resources owned by NetBasic.
Outputs:Logical
See Also:ORA:Logon
Example:UserName = "Scott"
Password = "Tiger"
Print("Loggin on"); NewLine
Handle = ORA:Logon(UserName,Password)
If (Handle>=0)
Print("Logged in"); NewLine
Print("Logging off"); NewLine
Sucess = ORA:Logoff(Handle)
If (Success)
Print("Logout successful"); NewLine
Else
Print("Logout failed"); NewLine
EndIf

Go to Table of Contents

ORA:Logon

Module:ORA.NLM
Purpose:Logs into Oracle.
Syntax:<hHandle>=ORA:Logon(<sUID>,<SPassword>)
Description:Establishes a communication between NetBasic and an Oracle database. <sUID> is a string specifying the username, an optional password, and an optional machine identifier. If you include the password as part of the <sUID> parameter, put it immediately after the username and separate it from the username with a '/.' Put the host machine identifier after the username or password, preceded by the '@' sign.

If the password is not included in this parameter, it must be in the pswd parameter. Examples of valid <sUID> parameters are:

name
name/password
name@d:nodename:dbname
name/password@d:nodename:dbname

The following is not a correct example of a <sUID>

name@d:nodename:dbname/password
Outputs:Oracle Handle
See Also:ORA:Logoff
Example:UserName = "Scott"
Password = "Tiger"
Print("Loggin on"); NewLine
Handle = ORA:Logon(UserName,Password)
If (Handle>=0)
Print("Logged in"); NewLine
Print("Logging off"); NewLine
Sucess = ORA:Logoff(Handle)
If (Success)
Print("Logout successful"); NewLine
Else
Print("Logout failed"); NewLine
EndIf
Else
Print("Login Failed"); NewLine
EndIf

Go to Table of Contents

ORA:SQL

Module:ORA.NLM
Purpose:Issues a Structured Query Language (SQL) command to access the database.
Syntax:<lSuccess>=ORA:SQL(<sQuery>)
Description:Submits an SQL query <sQuery> to the database.
Outputs:Logical
See Also:ORA:Record:Get
Example:SQL = "SELECT * FROM emp"
Success = ORA:SQL(Query)
Error = SYS:Error:Number
Print("SQL : ")
Print(Success); NewLine
Print("Error : ",DATA:String(Error)); NewLine

Go to Table of Contents

ORA:Record:Get

Module:ORA.NLM
Purpose:Locates the first and successive records for the last query.
Syntax:<lSuccess>=ORA:Record:Get
Description:Locates the first and successive records for the last query.
Outputs:Logical
See Also:ORA:Field:Get
Example:Do While (ORA:Record:Get)
Ename = ORA:Field:Get("ename")
Job = ORA:Field:Get("job")
Print(STR:Sub(STR:Pad:Right(Ename,25),1,19)))
Print(Job); NewLine
EndDo

Go to Table of Contents