Calling procedure from RPD. Error ORA-14552 as it has a commit.

Hi All,
I have implemented the calling of procedure functionality from rpd.
But our data base procedure that is called has commit in it which I guess is not allowed & so we are getting this error.
We need to commit once we finish off the procedure. Please suggest how we can achieve this.
State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 16001] ODBC error state: S1000 code: 14552 message: [Oracle][ODBC][Ora]ORA-14552: cannot perform a DDL, commit or rollback inside a query or DML ORA-06512: at "DWH.DWH_PA_TC_ACCRUAL_PKG", line 1565 ORA-14551: cannot perform a DML operation inside a query ORA-06512: at "DWH.TRAILING_COST_FUNCTION", line 8. [nQSError: 16011] ODBC error occurred while executing SQLExtendedFetch to retrieve the results of a SQL statement. (HY000)
Thanks.
pankaj

This is we are using from RPD to call the function:
SELECT trailing_cost_function('USD', 'JUN-08', ' POC', '', 'DJRC46', '') AS RET_VAL
FROM dual
Now this is the structure of the function which is in back end db:
CREATE OR REPLACE Function
Trailing_Cost_Function(a IN varchar2,b IN varchar2,c IN varchar2,d IN varchar2,e IN varchar2,
f IN varchar2) return
varchar2 IS
ret_o varchar2(50);
begin
test123; -- calling the procedure
ret_o:='0';
return ret_o;
end;
And the procedure is:
create or replace procedure test123 is
begin
insert into test_123 values ('asssd');
end test123;
Thanks,
Pankaj

Similar Messages

  • Calling Report from Form Error ORA-06508

    Dear all,
    I want migrate from Fom6i to Oracle Developer Suite 10g (10.1).
    Folder Form = C:\APLIORA\IRS\FORM
    Folder Report = C:\APLIORA\IRS\REPORT
    I have modified file DEFAULT.ENV
    FORMS_PATH=C:\APLIORA\IRS\FORM;C:\APLIORA\IRS\REPORT
    i do not have problem call a form from form.
    but when i call report from form show error ORA-06508 : PL/SQL : could not find program unit being called ; -6508
    my procedure is
    PROCEDURE Call_Report IS
         list_id ParamList;
    BEGIN
    list_id := Get_Parameter_List('input_params');
    IF NOT Id_Null(list_id) THEN
    Destroy_Parameter_List(list_id);
    END IF;
    list_id := Create_Parameter_List('input_params');
    Add_Parameter(list_id,'MAXIMIZE',TEXT_PARAMETER,'YES');
    Add_Parameter(list_id,'ORACLE_SHUTDOWN',TEXT_PARAMETER,'YES');
    RP2RRO.RP2RRO_RUN_PRODUCT(REPORTS,'TESTREPORT.REP',SYNCHRONOUS,RUNTIME,FILESYSTEM,list_id,null);
    END ;
    Do I miss something ?
    Can any one help ?
    Thanks

    Hi,
    Thank you for your replay.
    The problem have solved.
    This my step :
    1. Install Windows XP SP2 and Form 10.1.2.0.2 on new pc.
    2. Install Jinit version 1.3.1.28.
    3. Create report server
    3. Compile form, report and pll
    4. call report from from with this procedure :
    PROCEDURE Call_Report (vFILENAME varchar2) IS
    report_id                Report_Object;
    ReportServerJob VARCHAR2(100);
    vc_rep_status      VARCHAR2(100);
    repsvr                          varchar2(21) := 'myserv';
    userid                         VARCHAR2(100);
    pass                          VARCHAR2(100);
    Host                    VARCHAR2(100);
    BEGIN
    userid          := Get_Application_Property(USERNAME) ;
    pass          := Get_Application_Property(PASSWORD) ;
    Host          := Get_Application_Property(CONNECT_STRING) ;
    report_id:= find_report_object('REPORT');
    SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_FILENAME,vFILENAME||'.jsp');
    SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_COMM_MODE,SYNCHRONOUS);
    SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_SERVER,repsvr);
    ReportServerJob:=run_report_object(report_id);
    vc_rep_status := REPORT_OBJECT_STATUS(ReportServerJob);
    WHILE vc_rep_status in ('RUNNING','OPENING_REPORT','ENQUEUED', null)
    LOOP
    vc_rep_status:=REPORT_OBJECT_STATUS(ReportServerJob);
    END LOOP;
    IF vc_rep_status='FINISHED' THEN
    WEB.SHOW_DOCUMENT('/reports/rwservlet?report='||vFILENAME||'.jsp'||'&userid='||userid||'/'||pass||'@'||Host||'&destype=CACHE&desformat=PDF&paramform=yes','_blank');
    ELSE
    message ('Report failed with error message '|| vc_rep_status);
    END IF;
    END;
    Ok, but i have another strange error. I will post new thread.
    Thank you and regards
    Teguh S

  • ORA-20001: Oracle error -20001: ORA-20001: Oracle error -14552: ORA-14552: cannot perform a DDL, commit or rollback inside a query or DML has been detected in fnd_global.set_nls.set_parameter('NLS_LANGUAGE','AMERICAN'). has been detected in fnd_global.set

    ORA-20001: Oracle error -20001: ORA-20001: Oracle error -14552: ORA-14552: cannot perform a DDL, commit or rollback inside a query or DML has been detected in fnd_global.set_nls.set_parameter('NLS_LANGUAGE','AMERICAN'). has been detected in fnd_global.set_nls.
    this error generates everytime when i run a apex application
    i did call the package in session state with  dbms_session.set_nls('NLS_LANGUAGE','AMERICAN'); but still it shows the error in the report any solution please

    Hi Amrit
    Can you put the FND_GLOBAL calls in a pre map trigger/process rather than as part of the map?
    Cheers
    David

  • Is possible to call procedure from vorowimpl class

    Hi,
    please tell me how to call procedure from vorowimpl class.
    Thanks in advance,
    SAN

    Hi cruz,
    Thanks for your reply.
    I checked that link and they given for controller.
    But i want to call that from the vorowimpl class. but i tried similar like calling in the controller.
    here my code, please correct it if it is mistake.
    public AssessmentsAMImpl xxam;
    public String getXXCompName() {
    //return (String) getAttributeInternal(XXCOMPNAME);
    OADBTransaction txn=(OADBTransaction)xxam.getDBTransaction();
    String compName=getCompName();
    String xxName="";
    CallableStatement cs=txn.createCallableStatement("DECLARE OUTPARAM VARCHAR2(100);begin apps.XX_COMP_ELEMENTSVO_PROC(:1,:2);end;",0);
    try{
    cs.setString(1,compName);
    cs.registerOutParameter(2,OracleTypes.VARCHAR,0);
    cs.execute();
    xxName=cs.getString(1);
    catch(Exception e){
    try{
    cs.close();
    catch(Exception e){
    return xxName;
    }

  • ORA-14552: cannot perform a DDL, commit or rollback inside a query or DML;;

    Hi all,
    I have a problem!
    I have one PL SQL function doing an Update and insert into some oracle tables, this function return one number (0 or 1 or 2).
    I'm excuting this query from one PHP program to call the function :
    SELECT SALE.DB_FUNC_ASSOCIATE_TB2U('[email protected]',123)
    FROM dual;
    the problem that I have these errors :
    ERROR DB_FUNC_ASSOCIATE_TB2U Level 1 : ORA-01403: no data found
    ERROR DB_FUNC_ASSOCIATE_TB2U : ORA-14552: cannot perform a DDL, commit or rollback inside a query or DML
    there's a mean that i can do to call this function from PHP without getting this Error such as I tested this function using the script below and it works fine:
    declare
    a number;
    begin
    a:= SALE.DB_FUNC_ASSOCIATE_TB2U('[email protected]',123) ;
    end;
    Please help me :)
    regards,

    Sure, it works in the sense that you would no longer get an error.
    Creating this as an autonomous transaction, however, is going to blow your transactional integrity. You've now got code that is being called as the result of a SELECT operation (something that everyone that comes after you will assume is read-only) that commits outside of the current transaction scope. That is almost always a bad thing.
    In addition, having a WHEN OTHERS without a RAISE is almost always a bug. You're completely hiding the error message plus you're discarding proper exception handling in order to provide a return code and assuming that the caller is going to check the status. Relying on return status codes is normally a bad idea because it's very easy on the client side to forget to check the return code. Even if the client were to check the return code, it has no idea what went wrong, so it can't even log the root cause of the error.
    Justin

  • Database error - ORA-00028: your session has been killed

    Hi, I'm working with Discoverer 10g and eBS 11.5.9
    I have an application user (oracle) which works perfectly when I login with Discoverer Viewer, but when I try to login with Discoverer Desktop (the Oracle application user check box is checked),I have the following behaviour:
    1. I (apparently) connect to the DB
    2. I choose the responsibility
    3. I receive the error:
    Enable to connect to: oracle@rac
    Database error - ORA-00028: your session has been killed
    The strange thing is that this application user works perfectly with Viewer.....
    Anyone knows if there is some lock at the database level, and which lock ? or it's something related to the Discoverer Administrator's permissions ?
    Thanks in advance
    Alessandro

    Hi, I'm working with Discoverer 10g and eBS 11.5.9
    I have an application user (oracle) which works perfectly when I login with Discoverer Viewer, but when I try to login with Discoverer Desktop (the Oracle application user check box is checked),I have the following behaviour:
    1. I (apparently) connect to the DB
    2. I choose the responsibility
    3. I receive the error:
    Enable to connect to: oracle@rac
    Database error - ORA-00028: your session has been killed
    The strange thing is that this application user works perfectly with Viewer.....
    Anyone knows if there is some lock at the database level, and which lock ? or it's something related to the Discoverer Administrator's permissions ?
    Thanks in advance
    Alessandro

  • 'ORA-12571: TNS:packet writer failure' error while calling procedure from VC++

    hi all,
    i am writing stored procedures and calling these from vc++. I have one stored procedure in that all
    in and out perameters are numeric. When i am calling these procedure i am able to get the values properly. But in another procedure one in perameter is varchar and one out perameter is varchar. When i am calling these procedure from vc++ the error i am getting is "ORA-12571: TNS:packet writer failure". I test my vc++ code on different computers but its giving the same errors. I think ora-12571 error is when i can't communicate with oracle. But other stored procedures(in and out perameters are numbers) and sql statements are running properly. Only these stored procedure which has in and out perameters as varchar is giving me the above said problem. My out perameter in this procedure strtax is of type varchar and the length 100. Is it the problem. Please suggest me how to over come this problem.
    thanks in advance,
    with regards
    vali.

    Hi
    We recently changed our load balancer to a new load balancer. we get this error only after the load balancer change.
    When the error occurs, I could see ORA-12571 error message only in the application error log. The listener.log has only the following message about TNS 12502. It does not have any message about ORA -12571.
    TNS-12502: TNS:listener received no CONNECT_DATA from client
    12-MAR-2010 12:23:26 * (CONNECT_DATA=(SERVICE_NAME=AppName)(CID=(PROGRAM=c:\wind ows\system32\inetsrv\w3wp.exe)(HOST=WEB02)(USER=NETWORK?SERVICE))) * (ADDRESS=(PROTOCOL=tcp)(HOST=172.x.x.x.x)(PORT=2202)) * establish * AppName * 0
    12-MAR-2010 12:23:26 * (CONNECT_DATA=(SERVICE_NAME=AppName)(CID=(PROGRAM=c:\wind ows\system32\inetsrv\w3wp.exe)(HOST=WEB02)(USER=NETWORK?SERVICE))) * (ADDRESS=(PROTOCOL=tcp)(HOST=172.x.x.x.x)(PORT=2203)) * establish * AppName * 0
    12-MAR-2010 12:23:26 * (CONNECT_DATA=(SERVICE_NAME=AppName)(CID=(PROGRAM=c:\wind ows\system32\inetsrv\w3wp.exe)(HOST=WEB02)(USER=NETWORK?SERVICE))) * (ADDRESS=(PROTOCOL=tcp)(HOST=172.x.x.x.x)(PORT=2204)) * establish * AppName * 0
    12-MAR-2010 12:24:09 * 12502
    TNS-12502: TNS:listener received no CONNECT_DATA from client
    Thanks
    Ashok

  • Getting error while calling procedure from remote database

    When I am trying to call child procedure from remote database I am getting below error:
    ORA-02064: distributed operation not supported
    ORA-06512: at "NMUSER.NEW_CUST_UPLOAD", line 740
    (P.S. on line no 740 I issued "commit;" )
    I checked rights,synonym on all the objects they are fine.

    Oracle Error: ORA-02064
    Error Description:
    Distributed operation
    not supported
    Error Cause:
    One of the following
    unsupported operations was attempted:
    1. array execute of a remote update with a subquery that references a dblink,
    or
    2. an update of a long column with bind variable and an update of a second
    column with a subquery that both references a dblink and a bind variable, or
    3. a commit is issued in a coordinated session from an RPC procedure call
    with OUT parameters or function call.
    Cheers,
    Manik.

  • Error when calling procedure from form personalization

    Hi every body
    I want to call a procudre using form personalization . I made the procedure and in form personalization i call it as follow:
    built in type : Execute a Procedure
    Argument :
    ='GAZ_EMP_ASSIGN_UPDATE(' || :ASSGT.ORGANIZATION_ID || ', ' || :ASSGT.ASSIGNMENT_ID || ', ' || FND_PROFILE.VALUE('USER_ID') || ', ' || FND_PROFILE.VALUE('DB_SESSION_ID') ||' )'
    but the following error raised when i click on Apply Now button :
    the string (='GAZ_EMP_ASSIGN_UPDATE(' || :ASSGT.ORGANIZATION_ID || ', ' || :ASSGT.ASSIGNMENT_ID || ', ' || FND_PROFILE.VALUE('USER_ID') || ', ' || FND_PROFILE.VALUE('DB_SESSION_ID') ||' )' )
    couldn't be evaluated because of error ORA-06550 :line 1 , column 43
    PLS-00103:encountered the symbol ")" while expecting one of the folowing (- + ...... etc
    can anyone have a solution to this problem because it made me mad .(urgent)
    Or if anyone have another way to call the procedure ??
    Note that i want to pass db_session_id to the procedure from the application so does anyone have a complian about the way of passing this parameter to the procedure ??

    See http://oracle.ittoolbox.com/groups/technical-functional/oracle-apps-l/forms-personalization-execute-a-procedure-1778674

  • ORA-12571: TNS:packet writer failure while calling procedure from VC++

    hi all,
    i am writing stored procedures and calling these from vc++. I have one stored procedure in that all
    in and out perameters are numeric. When i am calling these procedure i am able to get the values properly. But in another procedure one in perameter is varchar and one out perameter is varchar. When i am calling these procedure from vc++ the error i am getting is "ORA-12571: TNS:packet writer failure". I test my vc++ code on different computers but its giving the same errors. I think ora-12571 error is when i can't communicate with oracle. But other stored procedures(in and out perameters are numbers) and sql statements are running properly. Only these stored procedure which has in and out perameters as varchar is giving me the above said problem. My out perameter in this procedure strtax is of type varchar and the length 100. Is it the problem. Please suggest me how to over come this problem.
    thanks in advance,
    with regards
    vali.

    hi,
    thanks for reply,
    I wanna let u know that this is my personal lappy & i have installed apps dump on it in Linux & connect it through VM player in Window environment. I have recently purchased a new Antivirus K7 & installed it on my Lappy. i wanna know does this impact your application or Dbase Bcoz the application is running fine after starting the services in linux.
    The only thing is that i am not able access the database through TOAD or SQL*Plus. the same error i am facing in both.
    So
    shud i uninstall the antivirus on this And this is the only solution to it ?
    If yes, then how do i fix it again when i'll reinstall it Bcoz i need Antivirus as well.
    kindly suggest.
    thanks
    D

  • Calling stored procedure from Java raises ORA-1722 exception

    Hi,
    As the title says, when I call the stored procedure from java I got the exception ORA-1722 (invalid number) but I've checked and rechecked my procedure on SQL-Developer and It's alright it works nice and clean !
    What's happening? is there something I'm missing?
    The way I call the stored procedure is:
        public void execProcedure(String procedure) {
            CallableStatement cs;
            try {
                cs = conn.prepareCall(procedure);
                cs.execute();
            } catch (SQLException ex) {
                Logger.getLogger(Database.class.getName()).log(Level.SEVERE, null, ex);
         where
        String procedure = "{call validateinfo}"I really need help on this, it's frustraiting me 'cause I need to finish a system but this little big problem is killing me ...
    Thanks any advice is very welcome :)

    Thanks for your help. Haven't tested the SP with a DB access client... which one do you recommend to use?
    The SP is the following:
    create or replace
    PROCEDURE validateInfo IS
      var number;
    BEGIN
      UPDATE temp_desarrollo
      SET status = '1';
      COMMIT;
      // Some string validations ...
      //This one just checks if the value of "monto" is a number
      //This update goes good
      UPDATE temp_desarrollo tmp
      SET cve_status = Decode(cve_status, NULL, '15', cve_status||',15')
      WHERE IsNumber(tmp.monto) = 'F';
      COMMIT;*/
      //This one just checks if the value of "monto" is greater than 0
      //if not, change de add to cve_status an errorValue
      UPDATE temp_desarrollo tmp
      SET cve_status = Decode(cve_status, NULL, '14', cve_status||',14')
      WHERE (cve_status NOT LIKE '%15%' OR cve_status IS NULL)
      AND to_number(tmp.monto) <= 0;
      COMMIT;
      //More string validations
      EXCEPTION
        WHEN OTHERS THEN
          var := SQLCODE;
          insert into excepciones values(to_char(var));
    END;I've deleted much code from the SP since I know there's nothing to do with the excepcion, just that UPDATE statement is the one giving me the exception.
    If those two UPDATES statements work with the same field (monto) why the first one is succeding and the second one not?
    Cheers,
    Federico
    P.S. the "isNumber" function is as follows, just in case.
    create or replace
    function IsNumber(val1 varchar2) return varchar2 is
      n number := null;
    begin
      n := to_number(val1,'9999999999999999.99');
        return 'T';
      exception
        when others then
          return 'F';
    end;

  • Call Procedure from a Button

    I am trying to call a procedure from a button that will work out the total of an order and display it in the total field in my master block.
    I am unsure as to how to call the prodcedure from my button. I have written the procedure in the PL/SQL Stored Program Units part like it says in the help file but am now stuck.
    I assume I use a WHEN-BUTTON-PRESSED trigger but what do I write in the trigger?

    What about placing outputs from the procedure to fields on the form?
    Here is the procedure I have created:
    procedure vatTotal (Order_no IN number,Total2 OUT number)
    AS
    CURSOR c_vatTotal is
    select order_line.quantity, gre_product.cost from ord, gre_product, order_line where ord.order_no = order_line.order_no AND
    gre_product.prod_no = order_line.Product_no;
    Total number;
    begin
    Total:= 0;
    for c_record in c_vatTotal loop
    Total := Total + c_record.quantity * c_record.cost;
    end loop;
    Total2 := Total;
    end;
    I believe this is correct. It compiles.
    I tried using Total as an out parameter but received the "duplicate fields in RECORD, TABLE or argument list are not permitted" error.

  • How to call procedure from java

    My database : oracle xe 10g
    I develop my application by use jdeveloper
    I call procedure following code :
    Class.forName("oracle.jdbc.driver.OracleDriver");
    Connection c = (Connection)DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "shm", "shm");
    CallableStatement cs = c.prepareCall("begin shm_increase_capital.ins_upd_tb_payment_rec_pc(:1,:2,:3,:4,:5,:6,:7);end;");
    cs.setLong(1, shareHolderId);
    cs.setString(2, companyCode);
    cs.setString(3, lotYear);
    cs.setLong(4, seqLot);
    cs.setLong(5, allocateId);
    cs.setLong(6, originateFrom);
    cs.setString(7, curUser);
    cs.execute();
    cs.close();
    c.close();
    When I run my application several times I found error :
    Exception in thread "main" java.sql.SQLException: Listener refused the connection with the following error:
    ORA-12519, TNS:no appropriate service handler found
    The Connection descriptor used by the client was:
    localhost:1521:XE
    Do you have another way for call procedure
    Please recommend me
    Thank you,
    Ja-ae

    I can call procedure
    but when I using my application too long
    I found error :
    Exception in thread "main" java.sql.SQLException: Listener refused the connection with the following error:
    ORA-12519, TNS:no appropriate service handler found
    The Connection descriptor used by the client was:
    localhost:1521:XE
    so, I think perhaps another way to call procedure for avoid this error

  • Problem with IN OUT parameters whiloe calling procedure from Form 6i

    Hi
    Could some help please? I have the following scenario.
    I am calling a stored procedure from form 6i by pressing a button on the form. Procedure has two IN OUT parameters, and I am passing these two IN OUT parameters and have declared them the way they are declared passed to the procedure. But I get an error when calling that procedure with these IN OUT parameters. the procedure works fine if parameters are IN only. The error says:
    PLS:00363: Expression '1' cannot be used as an assigment target.
    NO matter I pass some value or leave it blank, I get the same error message persistenetly.
    Please help.
    Thanks

    make sure you are calling your procedure with variables as parameters,
    i.e.
          l_v1 := 1 ;
          l_v2 := 'hello world' ;
          your_proc(l_v1, l_v2)
    not
          your_proc(1,'hello world')

  • How to call procedure from OCI ?

    How to call oracle procedure from OCI ?

    Following works on Windows, your mileage may vary. IIRC one of the standard OCI examples that install with the libraries demonstrates this too.
    /* SQL to create table and Stored Procedures */
    Create table OCI8StoredProcedureSampleTable
              (field1 number(5), field2 varchar2(30));
    CREATE OR REPLACE PROCEDURE OCI8StoredProcedureSample3
    (field1 number, field2 IN OUT varchar2)
    is
    begin
    insert into OCI8StoredProcedureSampleTable values (field1, field2);
    Commit;
    field2 := 'Successful';
    end;
    CREATE OR REPLACE PROCEDURE OCI8StoredProcedureSample4
    (field1 number, field2 char, field3 OUT varchar2)
    is
    begin
    insert into OCI8StoredProcedureSampleTable values (field1, field2);
    Commit;
    field3 := 'Successful';
    end;
    CREATE OR REPLACE FUNCTION OCI8StoredProcedureSample5
    RETURN VARCHAR2
    is
    v_Sysdate DATE;
    v_charSysdate VARCHAR2(20);
    begin
    SELECT TO_CHAR(SYSDATE, 'dd-mon-yyyy') into v_charSysdate FROM DUAL;
    return(v_charSysdate);
    end;
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <oci.h>
    static void checkerr (OCIError *p_err, sword status);
    void main()
    OCIEnv          *p_env;
    OCIError     *p_err;
    OCISvcCtx     *p_svc;
    OCIStmt          *p_sql;
    OCIBind p_Bind1 = (OCIBind ) 0;
    OCIBind p_Bind2 = (OCIBind ) 0;
    OCIBind p_Bind3 = (OCIBind ) 0;
    OCIDefine p_define1 = (OCIDefine ) 0;
    char field2[20] = "Entry 3";
    char *field3;
    //char field3[20];
    sword field1 = 3;
    text mySql = (text ) "Begin OCI8StoredProcedureSample3(:field1, :field2); END;";
    printf("OCIInitialize\n");
    checkerr(p_err, OCIInitialize((ub4) OCI_OBJECT,
              (dvoid *) 0, (dvoid * (*) ()) 0,           
              (dvoid * (*) ()) 0, (void (*) ()) 0));
    printf("OCIEnvInit\n");
    checkerr(p_err, OCIEnvInit(&p_env, (ub4) OCI_DEFAULT,
                        (size_t) 0, (dvoid **)0));
    printf("OCIHandleAlloc\n");
    checkerr(p_err, OCIHandleAlloc(p_env, &p_err, OCI_HTYPE_ERROR,
                        (size_t) 0, (dvoid **) 0));
    printf("OCIHandleAlloc\n");
    checkerr(p_err, OCIHandleAlloc(p_env, &p_svc, OCI_HTYPE_SVCCTX,
                        (size_t) 0, (dvoid **) 0));
    printf("OCIHandleAlloc\n");
    checkerr(p_err, OCIHandleAlloc(p_env, &p_sql, OCI_HTYPE_STMT, (size_t) 0, (dvoid **) 0));
    printf("OCILogon\n\n");
    checkerr(p_err, OCILogon(p_env, p_err, &p_svc, "SCOTT", 5, "TIGER", 5, "V8", 2));
    /* Example 1 - Using an IN OUT Parameters */
    printf("*************************************************\n");
    printf("Example 1 - Using an IN OUT Parameters\n");
    printf("*************************************************\n");
    printf("     OCIStmtPrepare\n");
    printf("          %s\n",mySql);
    checkerr(p_err, OCIStmtPrepare(p_sql, p_err, mySql,
                        (ub4) strlen(mySql), OCI_NTV_SYNTAX, OCI_DEFAULT));
    printf("     OCIBindByPos 1\n");
    checkerr(p_err, OCIBindByPos(p_sql, &p_Bind1, p_err, 1, (dvoid *) &field1, sizeof(sword),
                             SQLT_INT, 0, 0, 0, 0, 0, OCI_DEFAULT));
    printf("     OCIBindByPos 2\n");
    checkerr(p_err, OCIBindByPos(p_sql, &p_Bind2, p_err, 2, field2, (sizeof(field2) - 1),
                             SQLT_CHR, 0, 0, 0, 0, 0, OCI_DEFAULT));
    printf("          Field2 Before:\n");
    printf("               size     ---> %d\n", sizeof(field2));
    printf("               length     ---> %d\n", strlen(field2));
    printf("               value     ---> %s\n", field2);
    printf("     OCIStmtExecute\n");
    checkerr(p_err, OCIStmtExecute(p_svc, p_sql, p_err, (ub4) 1, (ub4) 0, (OCISnapshot *)
                   NULL, (OCISnapshot *) NULL, (ub4) OCI_COMMIT_ON_SUCCESS));
    printf("          Field2 After:\n");
    printf("               size     ---> %d\n", sizeof(field2));
    printf("               length     ---> %d\n", strlen(field2));
    printf("               value     ---> %s\n", field2);
    /* Example 2 - Using OUT Parameters */
    field1 = 4;
    strcpy(field2, "Entry 4");
    printf("\n\n*************************************************\n");
    printf("Example 2 - Using OUT Parameters\n");
    printf("*************************************************\n");
    printf("     OCIStmtPrepare\n");
    strcpy(mySql,(text *) "Begin OCI8StoredProcedureSample4(:field1, :field2, :field3); END;");
    printf("     %s\n",mySql);
    checkerr(p_err, OCIStmtPrepare(p_sql, p_err, mySql,
                        (ub4) strlen(mySql), OCI_NTV_SYNTAX, OCI_DEFAULT));
    printf("     OCIBindByPos 1\n");
    checkerr(p_err, OCIBindByPos(p_sql, &p_Bind1, p_err, 1, (dvoid *) &field1, sizeof(sword),
                             SQLT_INT, 0, 0, 0, 0, 0, OCI_DEFAULT));
    printf("     OCIBindByPos 2\n");
    checkerr(p_err, OCIBindByPos(p_sql, &p_Bind2, p_err, 2, field2, strlen(field2),
                             SQLT_CHR, 0, 0, 0, 0, 0, OCI_DEFAULT));
    printf("     OCIBindByPos 3\n");
    checkerr(p_err, OCIBindByPos(p_sql, &p_Bind3, p_err, 3, field3, 19,
                             SQLT_CHR, 0, 0, 0, 0, 0, OCI_DEFAULT));
    printf("     OCIStmtExecute\n");
    checkerr(p_err, OCIStmtExecute(p_svc, p_sql, p_err, (ub4) 1, (ub4) 0, (OCISnapshot *)
                   NULL, (OCISnapshot *) NULL, (ub4) OCI_COMMIT_ON_SUCCESS));
    printf("          Field3 After:\n");
    printf("               size     ---> %d\n", sizeof(field3));
    printf("               length     ---> %d\n", strlen(field3));
    printf("               value     ---> %s\n", field3);
    /* Example 3 - Using a Function to Return a Value */
    printf("\n\n*************************************************\n");
    printf("Example 3 - Using a Function to Return a Value \n");
    printf("*************************************************\n");
    printf("     OCIStmtPrepare\n");
    strcpy(mySql,(text *) "SELECT OCI8StoredProcedureSample5 from DUAL");
    printf("     %s\n",mySql);
    checkerr(p_err, OCIStmtPrepare(p_sql, p_err, mySql,
                        (ub4) strlen(mySql), OCI_NTV_SYNTAX, OCI_DEFAULT));
    checkerr(p_err, OCIDefineByPos(p_sql, &p_define1, p_err, 1, (dvoid *) field3,
              (sword) 20, SQLT_STR, (dvoid *) 0, (ub2 *)0,          (ub2 *)0, OCI_DEFAULT));
    printf("     OCIStmtExecute\n");
    checkerr(p_err, OCIStmtExecute(p_svc, p_sql, p_err, (ub4) 1, (ub4) 0, (OCISnapshot *)
                   NULL, (OCISnapshot *) NULL, (ub4) OCI_COMMIT_ON_SUCCESS));
    printf("          The return value:\n");
    printf("               size     ---> %d\n", sizeof(field3));
    printf("               length     ---> %d\n", strlen(field3));
    printf("               value     ---> %s\n", field3);
    return;
    static void checkerr(errhp, status)
    OCIError *errhp;sword status;
    text errbuf[512];
    ub4 errcode;
    switch (status)
              case OCI_SUCCESS:
                   break;
              case OCI_SUCCESS_WITH_INFO:
                   printf("Error - OCI_SUCCESS_WITH_INFO\n");
                   break;
              case OCI_NEED_DATA:
                   printf("Error - OCI_NEED_DATA\n");
                   break;
              case OCI_NO_DATA:
                   printf("Error - OCI_NO_DATA\n");
                   break;
              case OCI_ERROR:
                   OCIErrorGet ((dvoid *) errhp, (ub4) 1, (text *) NULL, &errcode,
                             errbuf, (ub4) sizeof(errbuf), (ub4) OCI_HTYPE_ERROR);
                   printf("Error - %s\n", errbuf);
                   break;
              case OCI_INVALID_HANDLE:
                   printf("Error - OCI_INVALID_HANDLE\n");
                   break;
              case OCI_STILL_EXECUTING:
                   printf("Error - OCI_STILL_EXECUTE\n");
                   break;
              case OCI_CONTINUE:
                   printf("Error - OCI_CONTINUE\n");
                   break;
              default:
                   break;

Maybe you are looking for