output parameter

Hi all

I'm using oracle 11.2.0.4

I m using this for the purpose of learning

I have a schema that contains tables of the Oracle scott with its data (for example, emp) schema

CREATE OR REPLACE PROCEDURE EMP_LOOKUP (P_EMPNO IN NUMBER,

O_ENAME ON EMP. ENAME % TYPE,

O_SAL ON EMP. SAL % TYPE)

AS

BEGIN

SELECT ENAME, SAL

IN O_ENAME, O_SAL

FROM EMP

WHERE EMPNO = P_EMPNO;

EXCEPTION

WHEN NO_DATE_FOUND

THEN

O_ENAME: = 'NULL ';

O_SAL: = - 1;

END;

When I am trying to execute the procedure, I get the below error

SQL > NAME of the VARIABLE VARCHAR2 (10);

SQL > SAL VARIABLE NUMBER;

SQL > EXEC EMP_LOOKUP(7782,:NAME,:SAL);

begin EMP_LOOKUP(7782,:NAME,:SAL); end;

ORA-06550: line 2, column 7:

PLS-00905: object PLSQL1. EMP_LOOKUP is not valid

ORA-06550: line 2, column 7:

PL/SQL: Statement ignored

NAME

---------

SAL

--------------------------------------------------------------------------------------------------------------------------------

But when I remove the exception block, then the procedure is running

CREATE OR REPLACE PROCEDURE EMP_LOOKUP (P_EMPNO IN NUMBER,

O_ENAME ON EMP. ENAME % TYPE,

O_SAL ON EMP. SAL % TYPE)

AS

BEGIN

SELECT ENAME, SAL

IN O_ENAME, O_SAL

FROM EMP

WHERE EMPNO = P_EMPNO;

END;

SQL > EXEC EMP_LOOKUP(7782,:NAME,:SAL);

PL/SQL procedure successfully completed

NAME

---------

CLARK

SAL

---------

2450

What is the problem here, I am not able to understand.

Please help me undersatnd

Thanks and respect.

Guylaine

No_Data_Found not No_Date_Found

Tags: Database

Similar Questions

  • Impossible to activate and deactivate the button "submit" all keeping the condition on the output parameter

    Hello

    I try to enable and disable the submit button based on the status of output parameter that I call in lov.

    Concerning

    Asia.


    Hi AJ,.

    Thanks for the reply

    I tried the method above, but it does not work.

    I am trying to enable and disable the submit button based on two input parameters and an output parameter.

    Based on two input parameters, I'm able to get the output parameter, and if the output parameter is "S" then iam allowing the submit button.

    on the other

    disable the submit button.

    Here is my code:

    IAM calling this co

    OASubmitButtonBean submitbean = (OASubmitButtonBean) webBean.findChildRecursive ("Submit");

    String crreason = pageContext.getParameter ("Reason")';

    Invnum string = pageContext.getParameter ("InvoiceNumber");

    String status = "";

    String ValidationDesc ="";

    OADBTransactionImpl oadbtransactionimpl = (OADBTransactionImpl) getTransaction ();

    Try

    {

    String sql_qry = "BEGIN WEPIS_CM_DM_PKG. WEPIS_CM_RAISE_VALIDATION (P_CM_REASON =>: 1, P_INVOICE =>: 2, P_VALDIDATION_S "+)

    "(TS =>: 3, P_VALDIDATION_DESC =>: 4); END; « ;

    OracleCallableStatement sqlstmt = (OracleCallableStatement) oadbtransactionimpl.createCallableStatement (sql_qry,-1);

    sqlstmt.setString(1,crreason);

    sqlstmt.setString(2,invnum);

    sqlstmt.registerOutParameter(3,Types.CHAR);

    sqlstmt.registerOutParameter(4,Types.VARCHAR);

    sqlstmt. Execute();

    status = sqlstmt.getString (3);

    ValidationDesc = sqlstmt.getString (4);

    If ("S".equals (status))

    {

    submitbean.setRendered (true);

    }

    on the other

    {

    submitbean.setRendered (false);

    }

    }

    catch (SQLException sqlexception)

    {

    throw OAException.wrapperException (sqlexception);

    }

    catch (System.Exception Exception)

    {

    throw OAException.wrapperException (exception);

    }

    Concerning

    S.Asia

  • Is the version of the output parameter 32 bits 12.1.0.2 Oracle ODBC driver truncating values a known issue?

    We test 12.1.0.2 Oracle and ODBC see problems with the stored procedure being cut output parameter values and Associates when we use the 12.1.0.2 driver (we use the 32-bit version). We see a function sequence error every time that happens, too.

    For example, a stored procedure takes a NVARCHAR2 name and it out as a separate NVARCHAR2 output parameter. Using the 12.1.0.2 of the ODBC driver, if we "Basketball", the output can be "Basketball" (with a function sequence error).

    What is happening to many of our stored procedures. We do not get the errors of sequence of function or output truncated if parameters we use the 12.1.0.1 version of the ODBC driver to connect to our 12.1.0.2 database, or if we use the version 11.2.0.4 or 11.2.0.2 ODBC driver.

    Is this a known problem in the 12.1.0.2 ODBC driver?

    Thank you

    Daniel Meyer

    to submit a bug report to MOS

  • Service Web REST-output parameter does not work in the Manager POSITION

    I created a RESTful Web Service in Oracle Apex, using a POST method as a 'Manager'   I have installation 11 input parameters which all work fine, this is my setting an output that does not return successfully.

    Here are details on the output parameter

    Name: returns

    Name of the bind Variable: : return

    Access method: OUTPUT

    Source type: response

    Parameter type: String

    The actual source is a call to a pl/sql package that returns a value that I set: Returns equal to (for example: Returns: = v_result).   I tried this with header Type of Source and still the same result, "no exit".

    I see APEX calls wwv_flow_api.create_restful_param to generate the (import) settings, is there documentation on this procedure?

    How can I get this output parameter to return something to the answer?

    The application accepts a load of Json.

    Any help greatly appreciated

    Thank you

    James

    Solved my problem: feedback does not need to go back

    Does not work

    Name: returns

    Name of the bind Variable: : return

    Access method: OUTPUT

    Source type: response

    Parameter type: String

    Works

    Name: returns

    Name of the bind Variable: returns

    Access method: OUTPUT

    Source type: response

    Parameter type: String

  • problem with the definition of a boolean as output parameter type

    Hi, I have a problem with the definition of type boolean as output parameter and it must return true if the query procedure retrieves one line else it shouuld return false

    Hi, I have a problem with the definition of type boolean as output parameter and it must return true if the query procedure retrieves one line else it shouuld return false

    And what are the issues? Its simple.

    SQL> create or replace procedure is_emp_exist
      2  (
      3     p_empno  in  emp.empno%type
      4   , p_result out boolean
      5  )
      6  as
      7     l_empno emp.empno%type;
      8  begin
      9     select empno into l_empno
     10       from emp
     11      where empno = p_empno;
     12
     13     p_result := true;
     14  exception
     15     when no_data_found then
     16        p_result := false;
     17  end;
     18  /
    
    Procedure created.
    
    SQL> declare
      2     l_result boolean;
      3  begin
      4     is_emp_exist (7788, l_result);
      5
      6     if l_result then
      7        dbms_output.put_line('Employee Exist');
      8     else
      9        dbms_output.put_line('Employee does not Exist');
     10     end if;
     11  end;
     12  /
    Employee Exist
    
    PL/SQL procedure successfully completed.
    
    SQL> declare
      2     l_result boolean;
      3  begin
      4     is_emp_exist (1000, l_result);
      5
      6     if l_result then
      7        dbms_output.put_line('Employee Exist');
      8     else
      9        dbms_output.put_line('Employee does not Exist');
     10     end if;
     11  end;
     12  /
    Employee does not Exist
    
    PL/SQL procedure successfully completed.
    
    SQL>
    
  • Get the output parameter of workflow using soap in PHP

    Hi all, I have a question on how to print the output in php parameter using the soap Protocol. I create the workflow with 1 single task scriptable with variable name of virtual machines as output like that.

    var sdkConnections = VcPlugin.allSdkConnections;
    vms = new Array();
    for (var i in sdkConnections) {
      var host = sdkConnections[i];
      var found;
      if (host.isInventoryServiceAvailable()) {
      found = host.getAllVirtualMachines();
      }
      for (var j in found) {
      vms.push(found[j]);
      System.log(vms);
      }
    }
    

    And my php, source code

    <?php
    
    include ("parameters.inc");
    $vco = new SoapClient('https://' . $vco_server . ':8281/vmware-vmo-webcontrol/webservice?WSDL');
    $workflowid = "f73f2521-0e6b-48e8-81b9-388b13fc3fea";
    $param = array(workflowId=>$workflowid,username=>$vco_user,password=>$vco_pass);
    echo '<br>';
    
    $result3 = $vco->executeWorkflow($param);
    print_r($result3);
    echo '<br>';
    
    foreach ($result3 as $token)
    {
            $tokenID = $token->id;
    }
    
    $param2 = array(workflowTokenId=>$tokenID,username=>$vco_user,password=>$vco_pass);
    $wftokenstatus = $vco->getWorkflowTokenStatus($param2);
    print_r($wftokenstatus);
    echo '<br>';
    
    $wftokenresult = $vco->getWorkflowTokenResult($param2);
    print_r($wftokenresult);
    echo '<br>';
    ?>
    

    When I try the same, executed release in web

    stdClass Object ( [executeWorkflowReturn] => stdClass Object ( [id] => ff808081440b6eb90144316de4bc04fe [title] => Copy of Get virtual machines by name [workflowId] => f73f2521-0e6b-48e8-81b9-388b13fc3fea [currentItemName] => __item-undefined__ [currentItemState] => running [globalState] => running [businessState] => [startDate] => 20140215002449+0700 [endDate] => [xmlContent] =>         ) )
    stdClass Object ( [getWorkflowTokenStatusReturn] => )
    stdClass Object ( [getWorkflowTokenResultReturn] => stdClass Object ( [name] => vms [type] => VC:VirtualMachine [value] => ) )
    

    I see in customer orchestrator, my workflow work well and in the logs tab I see all my VM appear, but I'm trying to print all components of table in my php script using print_r(), the value of the object always null, only can get name and type as above... No idea how to get the value of the output parameter?... Thanks before

    Change this code to your:

    for (var j in found) {
      vms.push(found[j]);
      System.log(vms);
      }
    

    To do this:

    for (var j in found) {
      vms.push(found[j].name);
      System.log(vms);
      }
    

    In this code, j is a VC:VirtualMachine object, instead of pushing the entire object in your table, just push the virtual machine to .name property. Additionally, make sure that your output variable is of type: Array of Strings

  • Output parameter is not created to Invoke in

    Hello

    I have a procedure with one IN and an OUTPUT parameter, I configured the DB adapter to call this procedure. Now using BPEL, when I call this procedure in the input variable only activity invoke gets does not create variable pitch, setting the EXIT procedure. What could be the problem? Please help me.

    concerning

    Nasir

    Thanks for your reply.

    I solved the problem, in fact, I was using a mediator for the transformation component. Now I just removed and used the transformation without him and it works now

  • An operator of power output parameter mapping

    Hello. I use on the 11.2.0.2.0 Oracle Database 11.2.0.2 OWB.

    I fight and need a pointer. I am trying to create a map that will pass parameters to USER_DEFINED operator in a process flow. I'm going by the following example.

    http://blogs.Oracle.com/warehousebuilder/entry/how_to_use_user_defined_activity_in_owb_process_flow

    But he gives no details on how to build the mapping. The settings I want to spend are stored in a database table, and I have a packaged procedure that takes a parameter (the key) and returns the three parameters that must be passed all the way to the user_defined in the process flow. The procedure basically collects the values of the parameters as the lines and the pivots in columns.

    I created a map containing a constant for the key, a mapping process before you run the proecedure and an operator of output parameter of mapping as the target of the mapping. I don't know if the prior mapping process is what I use. But I don't know what else to try. As it is, the mapping will not validate.

    I had already tried to use an operator unpivot instead of the procedure (btw, why do pivot/unpivot have meaning in SQL and the reverse in OWB?).

    Please suggest the best approach to send my parameter values to the output parameter of mapping operator. Thank you.

    Hello

    I suggest you write a pl/sql procedure to the hand that holds the key as a parameter and the three return values as of the settings out. Import it in owb and drag it in the process flow. Bind variables of process flow to the transformation parameters, then to USER_DEFINED operator settings.

    Kind regards
    Carsten.

  • How to run a procedure with the object as OUTPUT parameter

    Hello

    I have a procedure and it composed of 2 parameters, there is an input parameter and it's some ID (NUMBER datatype) and 2nd parameter is an output parameter and it an object type. I want to run this procedure, but not able to do the same thing. Can someone please suggest me how to run a procedure that got the object as output parameter.

    Thank you very much in advance for your support.

    Example:

    SQL> create or replace type t_obj as object (ename varchar2(10), deptno number);
      2  /
    
    Type created.
    
    SQL> ed
    Wrote file afiedt.buf
    
      1  create or replace procedure myproc (p_empno in number, obj out t_obj) is
      2  begin
      3    select t_obj(ename, deptno)
      4    into obj
      5    from emp
      6    where empno = p_empno;
      7* end;
    SQL> /
    
    Procedure created.
    
    SQL> set serverout on
    SQL> declare
      2    v_obj t_obj;
      3  begin
      4    myproc(7788, v_obj);
      5    dbms_output.put_line(v_obj.ename||','||v_obj.deptno);
      6  end;
      7  /
    SCOTT,20
    
    PL/SQL procedure successfully completed.
    
  • How to call a stored procedure with a REF CURSOR output parameter

    I'm looking forward to example calling a function/stored procedure with a REF CURSOR output parameter and get the result.
    In other words, I have a stored function/procedure that runs a SELECT statement using the OCI library and then he could get the values of each row and each column.

    I put a code snippet, it have only the main thing to call a simple stored procedure and to print the name of each column of the cursor, but I couldn t to print out values in the table that calls the stored procedure.
    I understand that the next step is to call an OCIStmtFetch.
    How to associate the slider with the OCIStmtFetch?

    If you need more information, just tell me.

    I use ANSI C with HP - UX (HP - UX C) operating system and Oracle 10 g.


    Kind regards.

    Antonio Garcia


    / * callOracleSP * /.

    #include < stdio.h >
    #include < string.h >
    #include < oci.h >
    #include < stdlib.h > to

    char * pConnectChar = "Server";
    char * pUsernameChar = "user";
    char * pPasswordChar = "passwd";
    char * sqlCharArray1 = "BEGIN SP_GETCITIES (:,: c); END; « ;
    int retval;
    UB4 parmcnt = 0;
    UB4 pos2 = 0;
    text * pcoln [20];
    UB4 namelen [20];
    char state_key [5];

    OCIStmt * pOciStatement;
    OCIStmt * pOciStatCursor;
    OCIError * pOciError;
    OCIEnv * pOciEnviron;
    OCIServer * pOciServer;
    OCISession * pOciSession;
    OCISvcCtx * pOciServiceContext;
    OCIBind * pOciBind [500];
    OCIParam * pOciParam;


    int main()
    {
    retval = OCIEnvCreate (& pOciEnviron, OCI_DEFAULT, NULL, NULL, NULL, NULL, 0, NULL);
    retval = OCIEnvInit (& pOciEnviron, OCI_DEFAULT, 0, NULL);
    retval = OCIHandleAlloc (pOciEnviron, (void *) & pOciError, OCI_HTYPE_ERROR, 0, NULL);
    retval = OCIHandleAlloc (pOciEnviron, (void *) & pOciServiceContext, OCI_HTYPE_SVCCTX, 0, NULL);
    retval = OCIHandleAlloc (pOciEnviron, (void *) & pOciStatement, OCI_HTYPE_STMT, 0, NULL);

    retval = OCILogon (pOciEnviron, pOciError, & pOciServiceContext,(unsigned char *) pUsernameChar,
    strlen (pUsernameChar), (unsigned char *) pPasswordChar, strlen (pPasswordChar).
    (unsigned char *) pConnectChar, strlen (pConnectChar));
    printf ("retval=%d\n",retval OCILogon);

    retval = OCIStmtPrepare (pOciStatement, pOciError, (unsigned char *) sqlCharArray1, strlen (sqlCharArray1),)
    OCI_NTV_SYNTAX, OCI_DEFAULT);
    printf ("StmtPrepare retval=%d\n",retval);

    retval = OCIHandleAlloc (pOciEnviron, (void *) & pOciStatCursor, OCI_HTYPE_STMT, 0, NULL);
    retval = 1 OCIBindByPos(pOciStatement,&pOciBind[0], pOciError, (ub4), (void *) & state_key,)
    ((sb4) sizeof (state_key), SQLT_STR, (void *) 0, (ub2 *) 0, (ub2 *) 0, (ub4) 0, (ub4 *) 0, OCI_DEFAULT (ub4));
    printf ("BindByPos OCI_HTYPE_STMT retval=%d\n",retval);

    retval = OCIBindByPos(pOciStatement,&pOciBind[1], pOciError, (ub4) 2, (void *) & pOciStatCursor,)
    ((sb4) 0, SQLT_RSET, (void *) 0, (ub2 *) 0, (ub2 *) 0, (ub4) 0, (ub4 *) 0, OCI_DEFAULT (ub4));
    printf ("BindByPos OCI_HTYPE_STMT retval=%d\n",retval);

    strcpy (state_key, 'ca');

    retval = OCIStmtExecute (pOciServiceContext, pOciStatement, pOciError, (ub4) 1, (ub4) 0,)
    (OCISnapshot *) NULL, (OCISnapshot *) NULL, OCI_DEFAULT (ub4));
    printf ("StmtExecute retval=%d\n",retval);

    / * How to get the values of the cursor? */

    / * Number of parameters of the cursor * /.
    OCIAttrGet ((void *) pOciStatCursor, OCI_HTYPE_STMT (ub4), (void *) & parmcnt,(ub4 *) 0,)
    (ub4) (OCI_ATTR_PARAM_COUNT, pOciError);
    printf ("\nNumber of the slider settings = %d\n",parmcnt);

    for (int pos = 1; pos < = (int) parmcnt; pos ++)
    {
    OCIAttrGet ((void *) pOciStatCursor, OCI_HTYPE_STMT (ub4), (void *) & pos2,(ub4 *) 0,)
    (ub4) (OCI_ATTR_CURRENT_POSITION, pOciError);
    retval = OCIParamGet ((void *) pOciStatCursor, OCI_HTYPE_STMT (ub4), pOciError, (void *) & pOciParam,)
    POS (ub4));
    OCIAttrGet pOciParam, (ub4) ((void*) OCI_DTYPE_PARAM,(void*) & pcoln [pos - 1],(ub4 *) & namelen [pos-1],)
    (ub4) OCI_ATTR_NAME,(OCIError *) pOciError);
    }
    for (int i = 1; i < = (int) parmcnt; i ++)
    printf ("%i\tNAME = % column. ("* s\n", i, namelen [i-1], pcoln [i-1]);

    return 0;
    }


    This is the script that create the table, insert records and create the stored procedure

    CREATE TABLE CITIES)
    STATE_CODE VARCHAR2 (2) NULL,
    CITY_CODE NUMBER (15.5) NULL,
    CITY_NAME VARCHAR2 (30) NULL
    )
    /


    INSERT INTO CITIES (STATE_CODE, CITY_CODE, CITY_NAME)
    VALUES ('CA', 30, 'SAN DIEGO')
    /
    INSERT INTO CITIES (STATE_CODE, CITY_CODE, CITY_NAME)
    VALUES ('CA', 40 'SACRAMENTO')
    /
    INSERT INTO CITIES (STATE_CODE, CITY_CODE, CITY_NAME)
    VALUES ('FL', 10, 'MIAMI')
    /
    INSERT INTO CITIES (STATE_CODE, CITY_CODE, CITY_NAME)
    VALUES ('FL', 20, 'ORLANDO')
    /
    INSERT INTO CITIES (STATE_CODE, CITY_CODE, CITY_NAME)
    VALUES ('NEW YORK', 10, 'NEW YORK')
    /
    INSERT INTO CITIES (STATE_CODE, CITY_CODE, CITY_NAME)
    VALUES ('NEW YORK', 20, 'ALBANY')
    /
    INSERT INTO CITIES (STATE_CODE, CITY_CODE, CITY_NAME)
    VALUES ('CA', 10, 'LOS ANGELES')
    /
    INSERT INTO CITIES (STATE_CODE, CITY_CODE, CITY_NAME)
    VALUES ('CA', 20, 'SAN FRANCISCO')
    /


    CREATE or REPLACE PACKAGE globalPkg AUTHID CURRENT_USER AS
    / * The following is specific global variables T/SQL. */
    TYPE RCT1 IS REF CURSOR; / * new cursor low definition * /.
    END globalPkg;
    /



    CREATE OR REPLACE PROCEDURE SP_ADDCITY)
    P_STATE_CODE IN VARCHAR,
    P_CITY_CODE NUMBER,
    P_CITY_NAME IN VARCHAR2,
    P_RETURN IN NUMBERS)
    AS
    StoO_error INTEGER;
    StoO_selcnt INTEGER;
    StoO_rowcnt INTEGER;
    StoO_errmsg VARCHAR2 (255);

    BEGIN
    StoO_rowcnt: = 0;
    StoO_error: = 0;
    StoO_selcnt: = 0;
    P_RETURN: = 0;
    INSERT INTO CITIES (STATE_CODE, CITY_CODE, CITY_NAME)
    VALUES (P_STATE_CODE, P_CITY_CODE, P_CITY_NAME);
    StoO_rowcnt: = number of LINES SQL %;
    EXCEPTION
    WHEN TOO_MANY_ROWS THEN
    StoO_rowcnt: = 2;
    WHILE OTHERS THEN
    StoO_rowcnt: = 0;
    StoO_selcnt: = 0;
    StoO_error: = SQLCODE;
    StoO_errmsg: = SQLERRM;
    IF StoO_error! = 0 THEN
    BEGIN
    P_RETURN: = 1;
    RETURN;
    END;
    END IF;
    END;
    /

    CREATE OR REPLACE PROCEDURE SP_GETCITIES)
    STATE_KEY IN VARCHAR,
    RC1 IN OUT globalPkg.RCT1)
    AS
    StoO_error INTEGER;
    StoO_selcnt INTEGER;
    StoO_rowcnt INTEGER;
    StoO_errmsg VARCHAR2 (255);
    BEGIN
    StoO_rowcnt: = 0;
    StoO_error: = 0;
    StoO_selcnt: = 0;
    OPEN FOR RC1
    SELECT STATE_CODE, CITY_CODE, FRANCISCO
    CITIES
    WHERE STATE_CODE = STATE_KEY
    ORDER BY CITY_CODE;
    StoO_rowcnt: = number of LINES SQL %;
    EXCEPTION
    WHILE OTHERS THEN
    StoO_rowcnt: = 0;
    StoO_error: = SQLCODE;
    StoO_errmsg: = SQLERRM;
    END;
    /

    Hi Antonio,.

    I see this:

    c_buf=(ub1 **)calloc(sizeof(ub1 *),3);
    
    ...
    
    rc=OCIDefineByPos(pOciStatCursor,&pdef,(OCIError *)pOciError,pos,c_buf[pos-1],size+1,(ub2)type,(dvoid *)c_indp[pos-1],(ub2 *)0,(ub2 *)0,OCI_DEFAULT);
    

    That I don't understand. You allocate space for 3 pointers ub1 but I don't see where these pointers are then initialized to point to where the data is to be stored.

    I do not read correctly?

    Sorry for posting code long, but here is an example of code that I have. It is much more 'code' for your code, but maybe that will be enough...

    NOTE: This is just the code example and not rigorous. For example, I don't check the memory, allocations etc in this code!

    Kind regards

    Mark

    #ifdef WIN32
    #define _CRT_SECURE_NO_DEPRECATE 1
    #endif
    
    #include 
    #include 
    #include 
    #include 
    
    void checkerr(sword status, OCIError *errhp);
    
    int main(int argc, char *argv[]) {
      OCIEnv      *envhp = NULL;  /* OCI Environment handle     */
      OCIError    *errhp = NULL;  /* OCI Error handle           */
      OCISvcCtx   *svchp = NULL;  /* OCI Service Context handle */
      OCIServer   *srvhp = NULL;  /* OCI Server handle          */
      OCISession  *usrhp = NULL;  /* OCI User Session handle    */
    
      OCIStmt     *stmtp = NULL;  /* OCI Statement handle       */
      OCIStmt     *cursr = NULL;  /* OCI Statement handle       */
    
      OCIParam    *prmp1 = NULL;  /* OCI Parameter handle       */
      OCIParam    *prmp2 = NULL;  /* OCI Parameter handle       */
      OCIParam    *prmp3 = NULL;  /* OCI Parameter handle       */
    
      OCIDefine   *defp1 = NULL;  /* OCI Define handle          */
      OCIDefine   *defp2 = NULL;  /* OCI Define handle          */
      OCIDefine   *defp3 = NULL;  /* OCI Define handle          */
    
      OCIBind     *bndp1 = NULL;  /* OCI Bind handle            */
      OCIBind     *bndp2 = NULL;  /* OCI Bind handle            */
      OCIBind     *bndp3 = NULL;  /* OCI Bind handle            */
    
      /* used to hold column width */
      ub2 col_width;
    
      /* used to set the prefetch count */
      ub4 prefetch_count = 32;
    
      /* will hold output from database */
      oratext *pEmpId = NULL;
      oratext *pFirstName = NULL;
      oratext *pLastName = NULL;
    
      /* the anonymous block to execute */
      /* this opens a ref cursor        */
      oratext *sqlstmt = "begin " \
                         "  open :1 for " \
                         "  select   to_char(employee_id), " \
                         "           first_name, " \
                         "           last_name " \
                         "  from     hr.employees " \
                         "  order by last_name, " \
                         "           first_name; " \
                         "end;";
    
      /* used to hold the results of each OCI call */
      sword result = 0;
    
      /* Initialize and create a default environment  */
      result = OCIEnvCreate(&envhp,
                            OCI_DEFAULT,
                            (dvoid *) 0,
                            0,
                            0,
                            0,
                            (size_t) 0,
                            (dvoid **) 0);
    
      /* allocate an error handle */
      result = OCIHandleAlloc((dvoid *) envhp,
                              (dvoid **) &errhp,
                              OCI_HTYPE_ERROR,
                              0,
                              (dvoid **) 0);
    
      /* allocate a service context handle */
      result = OCIHandleAlloc((dvoid *) envhp,
                              (dvoid **) &svchp,
                              OCI_HTYPE_SVCCTX,
                              0,
                              (dvoid **) 0);
    
      /* allocate a server handle */
      result = OCIHandleAlloc((dvoid *) envhp,
                              (dvoid **) &srvhp,
                              OCI_HTYPE_SERVER,
                              0,
                              (dvoid **) 0);
    
      /* allocate a user session handle */
      result = OCIHandleAlloc((dvoid *) envhp,
                              (dvoid **) &usrhp,
                              OCI_HTYPE_SESSION,
                              0,
                              (dvoid **) 0);
    
      /* create a server context using the "ORADEMO" database */
      result = OCIServerAttach(srvhp,
                               errhp,
                               "ORADEMO",
                               (ub4) strlen("ORADEMO"),
                               OCI_DEFAULT);
    
      /* set the server attribute in the service context handle */
      result = OCIAttrSet((dvoid *) svchp,
                          OCI_HTYPE_SVCCTX,
                          (dvoid *) srvhp,
                          (ub4) 0,
                          OCI_ATTR_SERVER,
                          errhp);
    
      /* open the session with the database */
      /* using external authentication      */
      result = OCISessionBegin(svchp,
                               errhp,
                               usrhp,
                               OCI_CRED_EXT,
                               OCI_DEFAULT);
    
      /* set the user session attribute in the service context handle */
      result = OCIAttrSet((dvoid *) svchp,
                          OCI_HTYPE_SVCCTX,
                          (dvoid *) usrhp,
                          (ub4) 0,
                          OCI_ATTR_SESSION,
                          errhp);
    
      /* allocate the statement handle */
      result = OCIHandleAlloc((dvoid *) envhp,
                              (dvoid **) &stmtp,
                              OCI_HTYPE_STMT,
                              0,
                              (dvoid **) 0);
    
      /* prepare the statement for execution */
      result = OCIStmtPrepare(stmtp,
                              errhp,
                              sqlstmt,
                              (ub4) strlen((char *) sqlstmt),
                              OCI_NTV_SYNTAX,
                              OCI_DEFAULT);
    
      /* allocate the handle for the ref cursor */
      result = OCIHandleAlloc((dvoid *) envhp,
                              (void **) &cursr,
                              OCI_HTYPE_STMT,
                              0,
                              NULL);
    
      /* bind the ref cursor parameter */
      result = OCIBindByPos(stmtp,
                            &bndp1,
                            errhp,
                            1,
                            &cursr,
                            0,
                            SQLT_RSET,
                            NULL,
                            0,
                            NULL,
                            0,
                            0,
                            OCI_DEFAULT);
    
      /* execute the statement */
      result = OCIStmtExecute(svchp,
                              stmtp,
                              errhp,
                              1,
                              0,
                              NULL,
                              NULL,
                              OCI_DEFAULT);  
    
      /* get parameter descriptor for first column */
      result = OCIParamGet((dvoid *) cursr,
                           OCI_HTYPE_STMT,
                           errhp,
                           (dvoid **) &prmp1,
                           (ub4) 1);
    
      /* get parameter descriptor for second column */
      result = OCIParamGet((dvoid *) cursr,
                           OCI_HTYPE_STMT,
                           errhp,
                           (dvoid **) &prmp2,
                           (ub4) 2);
    
      /* get parameter descriptor for third column */
      result = OCIParamGet((dvoid *) cursr,
                           OCI_HTYPE_STMT,
                           errhp,
                           (dvoid **) &prmp3,
                           (ub4) 3);
    
      /* get the first column width in characters */
      result = OCIAttrGet((dvoid*) prmp1,
                          (ub4) OCI_DTYPE_PARAM,
                          (dvoid*) &col_width,
                          (ub4 *) 0,
                          (ub4) OCI_ATTR_DATA_SIZE,
                          errhp);
    
      /* allocate memory to hold the result */
      pEmpId = (oratext *) malloc(sizeof(oratext) * (col_width + 1));
    
      /* define the first column in the results */
      result = OCIDefineByPos(cursr,
                              &defp1,
                              errhp,
                              1,
                              (dvoid *) pEmpId,
                              (sword) col_width + 1,
                              SQLT_STR,
                              (dvoid *) NULL,
                              (ub2 *) 0,
                              (ub2 *) 0,
                              OCI_DEFAULT);
    
      /* get the second column width in characters */
      result = OCIAttrGet((dvoid*) prmp2,
                          (ub4) OCI_DTYPE_PARAM,
                          (dvoid*) &col_width,
                          (ub4 *) 0,
                          (ub4) OCI_ATTR_DATA_SIZE,
                          errhp);
    
      /* allocate memory to hold the result */
      pFirstName = (oratext *) malloc(sizeof(oratext) * (col_width + 1));
    
      /* define the second column in the results */
      result = OCIDefineByPos(cursr,
                              &defp2,
                              errhp,
                              2,
                              (dvoid *) pFirstName,
                              (sword) col_width + 1,
                              SQLT_STR,
                              (dvoid *) NULL,
                              (ub2 *) 0,
                              (ub2 *) 0,
                              OCI_DEFAULT);
    
      /* get the third column width in characters */
      result = OCIAttrGet((dvoid*) prmp3,
                          (ub4) OCI_DTYPE_PARAM,
                          (dvoid*) &col_width,
                          (ub4 *) 0,
                          (ub4) OCI_ATTR_DATA_SIZE,
                          errhp);
    
      /* allocate memory to hold the result */
      pLastName = (oratext *) malloc(sizeof(oratext) * (col_width + 1));
    
      /* define the third column in the results */
      result = OCIDefineByPos(cursr,
                              &defp3,
                              errhp,
                              3,
                              (dvoid *) pLastName,
                              (sword) col_width + 1,
                              SQLT_STR,
                              (dvoid *) NULL,
                              (ub2 *) 0,
                              (ub2 *) 0,
                              OCI_DEFAULT);
    
      /* loop through and print the results */
      while ((result = OCIStmtFetch(cursr,
                                    errhp,
                                    (ub4) 1,
                                    (ub2) OCI_FETCH_NEXT,
                                    (ub4) OCI_DEFAULT)) == OCI_SUCCESS)
      {
        printf("Employee ID: %s\n", pEmpId);
        printf(" First Name: %s\n", pFirstName);
        printf("  Last Name: %s\n\n", pLastName);
      }
    
      /* free allocated memory */
      free(pEmpId);
      free(pFirstName);
      free(pLastName);
    
      pEmpId = NULL;
      pFirstName = NULL;
      pLastName = NULL;
    
      /* terminate the session with the database */
      result = OCISessionEnd(svchp, errhp, usrhp, OCI_DEFAULT);
    
      /* detach from the server */
      result = OCIServerDetach(srvhp, errhp, OCI_DEFAULT);
    
      /* deallocate the environment handle     */
      /* OCI will deallocate the child handles */
      result = OCIHandleFree((dvoid *) envhp, OCI_HTYPE_ENV);
    
      return OCI_SUCCESS;
    }
    
    void checkerr(sword status, OCIError *errhp)
    {
      oratext errbuf[512];
      sb4 errcode = 0;
    
      switch (status) {
        case OCI_SUCCESS:
          break;
    
        case OCI_ERROR:
        case OCI_SUCCESS_WITH_INFO:
          (void) OCIErrorGet((dvoid *) errhp, (ub4) 1, (oratext *) NULL, &errcode, errbuf, (ub4) sizeof(errbuf), OCI_HTYPE_ERROR);
          (void) printf("Error: %.*s\n", sizeof(errbuf), errbuf);
          break;
    
        case OCI_NEED_DATA:
          (void) printf("Error - OCI_NEED_DATA\n");
          break;
    
        case OCI_NO_DATA:
          (void) printf("Error - OCI_NO_DATA\n");
          break;
    
        case OCI_INVALID_HANDLE:
          (void) printf("Error - OCI_INVALID_HANDLE\n");
          break;
    
        case OCI_STILL_EXECUTING:
          (void) printf("Error - OCI_STILL_EXECUTING\n");
          break;
    
        case OCI_CONTINUE:
          (void) printf("Error - OCI_CONTINUE\n");
          break;
    
        default:
          break;
      }
    }
    
  • The formal parameter, quot;@CCNumber &amp; quot; was not declared as OUTPUT parameter

    This stored procedure was working till last week and I do not remember change all the input variables / outputs, so I don't know why I get the error message I get. I counted and tells all the parameters in the CF to ensure that none are missing, but SQL still think I'm missing something. Can someone take a look at the code and see why SQL account 53 settings when there is really some 54?

    The beginning of MS:

    ALTER PROCEDURE [dbo]. [pr_EnterWebOrder]
    @User_Fk int,
    @Coupon_Fk int,
    @GiftCertificate varchar (200),
    Silver @GCAmount,
    @OrderNotes varchar (200),
    @PaymentMethod varchar (10),
    @CreditCard_Fk int,
    @BillTitle varchar (10),
    @BillFirstName varchar (50),
    @BillLastName varchar (50),
    @BillMiddleName varchar (50),
    @BillCompanyName varchar (50),
    @BillAddress varchar (2000).
    @BillCity varchar (50),
    @BillState_Fk int,
    @BillZip varchar (20),
    @BillProvince varchar (50),
    @BillCountry_Fk int,
    @BillPhone varchar (50),
    @BillExt varchar (8),
    @BillEmail varchar (100),
    @ShipTitle varchar (10),
    @ShipFirstName varchar (50),
    @ShipLastName varchar (50),
    @ShipMiddleName varchar (50),
    @ShipCompanyName varchar (50),
    @ShipAddress varchar (2000).
    @ShipCity varchar (50),
    @ShipState_Fk int,
    @ShipZip varchar (20),
    @ShipProvince varchar (50),
    @ShipCountry_Fk int,
    @ShipPhone varchar (50),
    @ShipExt varchar (8),
    @ShipEmail varchar (100),
    @OrderEditor_Fk int,
    @AdminUUID char (35),
    @CreditAccount int,
    @TransactionNumber varchar (20),
    @AffiliateCode varchar (50),
    @Register int,
    @OrderSource_Pk int,
    @CheckoutCharity int,
    @AuthCode varchar (6).
    @AffiliateLinkType int,
    Silver @CreditReceived,
    Silver @CashReceived,
    @PONumber varchar (20),
    @PromisedDate DateTime,
    @ShipDate DateTime,
    @CheckNumber varchar (20),
    @CCNumber varchar (200),
    @CCExpDate int,
    @Order_Pk int OUTPUT,.
    @OrderNumber varchar (20) OUTPUT

    The CF code calling:


    The error message in SQL. Notice that he just thinks there are 53 settings when there are 54:

    SQLSTATE HY000
    SQL {call pr_EnterWebOrder ((param 1), (param 2), (param 3), (param 4), (param 5), (param 6), (param 7), (param 8), (param 9), (param 10), (param 11), (param 12), (param 13), (param 14), (param 15), (param 16), (param 17), (param 18), (param 19), (param 20), (param 21), (parameter 22), (param 23), (24 param), (param 25), (param 26), (param 27), (param 28), (param 29) (param 30)} (, (param 31), (param 32), (param 33), (param 34), (35 param), (param 36), (param 37), (38 param), (param 39), (param 40), (param 41), (param 42), (param 43), (param 44), (param 45), (param 46), (param 47), (param 48), (param 49), (param 50), (param 51), (param 52), (param 53))}

    [Macromedia] [SQLServer JDBC Driver] [SQL Server] The formal parameter '@CCNumber' declared as OUTPUT, but the real parameter output parameter.

    Found the answer. CF error incorrect when you send an empty value for a cfsqltype DATE in a cfprocparam tag. Rather than tell you that data types do not match, it seems that it removes this procparam from the code.

  • the output parameter mapping

    How can pass us values as output parameters that never I assign it says that it is limited and cannot be done.

    What values we can pass as output parameters. for a mapping of the output parameters.

    Thanks in advance.

    Hello

    You can use the function that you created in the process flow and set its result in a variable (or bind the output parameter of mapping a process flow variable), the variable can then be tested in conditions of transition, conditions, etc. in loop.

    See you soon
    David

  • Output parameter does not value of the column formatting

    Here's my table structure:

    < h4 > < font color = "Blue" > CREATE TABLE 'SSPFUSER05 '. "' PEOPLE '.
    (SSN NUMBER (13.0),)
    PIN VARCHAR2 (7-BYTE)
    ) ; < / make >
    < / h4 >

    And here is my procedure below:

    < h4 > < font color = "Blue" >
    CREATE OR REPLACE
    PROCEDURE SP_SSN_BY_PIN)
    V_REQUESTEDPIN IN VARCHAR2,
    V_SSN TANK)
    AS
    BEGIN
    SELECT
    LPAD (SSN, 13, '0')
    IN
    V_SSN
    Of
    SSPFUSER05. PEOPLE
    WHERE
    PIN = V_REQUESTEDPIN;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    V_SSN: = NULL;
    END; < / police > < / h4 >

    As you can see that the type of the column SSN is NUMBER (13,0). But I leftpad with 0 and assign it to my output V_SSN parameter, whose type is of type CHAR. But I 111196100099 instead of 0111196100099. I tried TO_CHAR (LPAD (SSN, 13, '0')) but does not always help. However, if I return that left padded inside a SYS_REFCURSOR SSN I get what I want. What should I do to achieve this?

    Depends on...

    SQL> CREATE TABLE PERSONS
      2  ( SSN NUMBER(13,0),
      3  PIN VARCHAR2(7 BYTE)
      4  );
    
    Table created.
    
    SQL> CREATE OR REPLACE
      2  PROCEDURE SP_SSN_BY_PIN(
      3  V_REQUESTEDPIN IN VARCHAR2,
      4  V_SSN OUT CHAR)
      5  AS
      6  BEGIN
      7  SELECT
      8  LPAD(SSN,13,'0')
      9  INTO
     10  V_SSN
     11  FROM
     12  PERSONS
     13  WHERE
     14  PIN=V_REQUESTEDPIN;
     15  EXCEPTION
     16  WHEN NO_DATA_FOUND THEN
     17  V_SSN:=NULL;
     18  END;
     19  /
    
    Procedure created.
    
    SQL> insert into PERSONS values(123,'abc');
    
    1 row created.
    
    SQL> commit;
    
    Commit complete.
    
    SQL> declare
      2  v_temp_1 char(100);
      3  v_temp_2 number;
      4  begin
      5  SP_SSN_BY_PIN('abc',v_temp_1);
      6  SP_SSN_BY_PIN('abc',v_temp_2);
      7  dbms_output.put_line(v_temp_1);
      8  dbms_output.put_line(v_temp_2);
      9  end;
     10  /
    0000000000123
    123
    
    PL/SQL procedure successfully completed.
    
    SQL>
    
  • question about the date as output parameter

    Hello
    I tried the following procedure to extract the out parameter as DD/MM/YYYY
    CREATE or replace PROCEDURE p1 (p IN NUMBER, x OUT date, y OUT date) 
    IS 
    BEGIN    
    x := to_date(to_char(sysdate,'dd/mm/yyyy'),'dd/mm/yyyy') ;
    y:=  to_date(to_char(sysdate+1,'dd/mm/yyyy'),'dd/mm/yyyy') ;
    END P1; 
    
    declare    
    foo date;    
    bar date; 
    begin    
    p1(5,foo,bar);    
    dbms_output.put_line(foo || ' ' || bar); 
    end; 
    
    And the output is   17-AUG-12 18-AUG-12   , instead of   17/08/2012   18/08/2012  
    The nls_date_format is: DD - MON - RR

    How can I get the output as dd/mm/yyyy format parameter.
    Thank you

    Published by: Smile on August 17, 2012 08:31

    Because your data type is date, the default output is the NLS_DATE_FORMAT.

    You can set NLS_DATE_FORMAT jj/mm/aaaa, but in reality, it would be better to do the following:

    Declare your out parameters as varchar2
    Convert date to be returned to your format of binding and value the more parameetrs to have this value

  • A stored procedure with input &amp; output parameter as XML

    Hello

    I have a requirement in which I need to have a stored procedure accepts with huge XML from Java and MS a process all the records in the XML file and return the output with a few messages inside XML.

    CurrentY, I have a stored procedure to process the xml code stored in the Oracle database.

    I am using the following SQL statement to read data from the XML column.
    select xmltest1.id,xmltest1.name 
      from xmltest,
           XMLTABLE(
              XMLNamespaces(default 'syncpsna/schemas'),
              '/XMLTestRequest/insert/row'
                    PASSING xmltest.data_xml
                    COLUMNS
                    "ID" number(10) PATH 'id',
                    "NAME" varchar2(50) PATH 'name') xmltest1
    where xmltest.id = 2;
    I want to run similar queries to retrieve data from the XML passed as parameter of entry of JAVA.

    If I could get some examples to read the XML and return the xml to the calling program.

    Concerning

    I can run the query to extract the different sections in the xml file when the XML is stored in a table column. How can do the same thing on XML passed as an input parameter.

    Pretty much the same path, using the clause of PASSAGE.
    Assuming that the input XML is passed as parameter 'p_inputXML', you can do:

    SELECT x.id
         , x.name
    FROM XMLTable(
           XMLNamespaces(default 'syncpsna/schemas'),
           '/XMLTestRequest/insert/row'
           PASSING p_inputXML
           COLUMNS
             "ID"   number(10)   PATH 'id',
             "NAME" varchar2(50) PATH 'name'
         ) x
    ;
    
  • Get the error on the output parameter when creating the effect

    Hi guys, I develop an adobe after effect plugins recently, thanks to all those who help me during this period. Now, when everything all right and I want to build it on a release, I got the following error:

    11.png

    44.png

    Here's my output setting:

    22.png33.png

    what I'm missing? However, it works ok on the debug version.

    Hello

    I found the solution for the release configuration:

    Trun on the links/debug Editor, then set Generate Debug Info--> optimize the debugging (?) DEBUGGING)

    Thank you all

Maybe you are looking for

  • Albums Photos custom within folders disappeared after the update of the Sierra

    Before the upgrade to Sierra, I had created a lot of albums for specific events (file > New Album...) in pictures and placed them in folders (file > new folder). After the upgrade, all these folders and albums are now missing from the sidebar, but wh

  • HP omni 27-1010ea video card update

    The imtergrated video card can be improved?

  • HP Power Manager doesen't work

    Hi, I wanted to change my HP plan recommended for high performance and it doesen't change, it is still blocking on the recommended HP plan, I want to solve this problem, I have reinstalled the program without result same thing, what do I do to fix th

  • Micro system

    I turned off my computers microphone.  to save other empty titles to use as breaks in the media player. I can't find where to turn them back on. Thank you Steven V

  • HP OfficeJet 4620 ink questions

    Hello I'm having a problem with my ink cartridges. Yesterday I bought a pack of 4 inks (564XL) for my 4620 printer all in one and I have replaced three of them (Cyan, Magenta and yellow). This morning my printer tells me that these three should be re