OD Execute object

4D - Documentation   Français   English   German   English   4D for Oracle, Command Theme List   4D for Oracle, Command Alphabetical List   Back   Previous   Next

version 6.5


OD Execute object (login_ID; command{; typeObject}) Integer

ParameterTypeDescription
login_IDLongintConnection Identifier
commandString | TextCommand to execute
typeObjectPointerPointer to function result or Nil = Procedure
Function resultIntegerNumber of output (or input-output) parameters
passed to the object, or -1 if an error occurs

Description

The command OD Execute object allows you to execute a stored procedure or stored function that is or is not located in an Oracle package. You will receive the results of the procedure or function when it applies.

login_ID must be a valid connection identifier or a valid process identifier.

command is the name of the procedure or function you need to call. For example, if you want call a procedure included in a package, you will pass the following line:

"MyPackage.MyProcedure(Param1,Param2,...,ParamN)".

For a simple function, you will pass "MyFunction(Param1,...,ParamN)".

typeObject is the buffer in which the return value will be stored. This pointer indicates if the command is a function or a procedure. A Nil pointer indicates a procedure.

OD Execute object returns -1 if it failed or 1 if succeeded.

Note: This command does not accept arrays as parameters.

Example

Considering the following Oracle stored procedure:

   PROCEDURE BIGBEN (dateortime in FLOAT, answer out varchar2) is

   Begin

      IF dateortime = 0 THEN answer:='valeur 0 non autorisee';

      ELSIF dateortime = 1 THEN
         select to_char (Sysdate,'hh24:mi:ss') into answer from DUAL;

      ELSIF dateortime = 2 THEN
         select to_char (Sysdate,'dd/mm/yyyy') into answer from DUAL;

      ELSIF dateortime = 3 THEN
         select to_char(Sysdate,'hh24:mi:ss dd/mm/yyyy') into answer from DUAL;

      ELSIF dateortime = 4 THEN
      select to_char(Sysdate,'hh24:mi dd/mm/yyyy') into answer from DUAL;

      ELSE answer:= '??? ' || (dateortime);

      End IF;

   End BIGBEN;

Now, to invoke this procedure from 4D and receive the result, the following code could be used:

   C_REAL(vReal)
   C_TEXT(vAlpha)

   vReal:=Num(Request("Format number ? (1...n)";"1"))
   If (OK=1)
      vAlpha:=""
      $Err:=OD Execute object (<>LoginID;"BIGBEN(<<vReal>>,<<vAlpha>>)")
      ALERT(vAlpha)
   End if 

If the same Oracle procedure was included in a package named My_Package, the 4D method would then become :

   C_REAL(vReal)
   C_TEXT(vAlpha)

   vReal:=Num(Request("Format number ? (1...n)";"1"))
   If (OK=1)
      vAlpha:=""
      $Err:=OD Execute object (<>LoginID;"My_Package.BIGBEN(<<vReal>>,<<vAlpha>>)")
      ALERT(vAlpha)
   End if

Warning: The request "BIGBEN(<<vReal>>,<<vAlpha>>)" is valid, but the request "BIGBEN(5,"1")" would not be valid. You cannot pass directly a value as parameter.


4D - Documentation   Français   English   German   English   4D for Oracle, Command Theme List   4D for Oracle, Command Alphabetical List   Back   Previous   Next