FND_REQUEST PL/SQL procedure with parameters

Hi guys
I have created a concurrent program, using PL/SQL procedure which has 2 in parameters. I am trying to call the concurrent program using
v_req_id :=FND_REQUEST.SUBMIT_REQUEST('INV','OMS_POP_INVVALUES_P',
NULL,SYSDATE,FALSE,l_on_date, l_org_id,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL
COMMIT;
However, the concurrent program always failing with
**Starts**26-AUG-2013 14:02:31 ORACLE error 6550 in FDPSTP Cause: FDPSTP failed due to ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'OMS_POP_INVVALUES_P' ORA-06550: line 1, column 7: PL/SQL: Statement ignored
and I doubt it is because the database procedure call is not proper.
I have set four parameters with the concurrent program, as they were with the procedure itself, which are
p_on_date IN DATE, p_org_id IN NUMBER, errbuff   OUT VARCHAR2,retcode   OUT VARCHAR2
Please help
regards,
raj

Okay I fixed the problem by
1. Changing the order of parameters with Procedure like following
CREATE OR REPLACE PROCEDURE OMS_POP_INVVALUES_P (
errbuff   OUT VARCHAR2,retcode   OUT NUMBER, p_on_date IN DATE, p_org_id IN NUMBER)
IS
and then changing the concurrent program call like following
l_req_id :=
      fnd_request.submit_request('INV','OMS_POP_INVVALUES_P',
                                                                    NULL,SYSDATE,FALSE,l_in_date, l_org_id,CHR(0));
   :SYSTEM.Message_Level := '25';
   COMMIT;
after removing all the parameters from the program parameter list. No need to pass any value for errbuff and retcode, just pass other parameters and end the parameter list with CHR(0). Hope this is useful for somebody else out there.
Regards,
raj

Similar Messages

  • T-sql 2008 r2 place results from calling a stored procedure with parameters into a temp table

    I would like to know if the following sql can be used to obtain specific columns from calling a stored procedure with parameters:
    /* Create TempTable */
    CREATE TABLE #tempTable
    (MyDate SMALLDATETIME,
    IntValue INT)
    GO
    /* Run SP and Insert Value in TempTable */
    INSERT INTO #tempTable
    (MyDate,
    IntValue)
    EXEC TestSP @parm1, @parm2
    If the above does not work or there is a better way to accomplish this goal, please let me know how to change the sql?

    declare @result varchar(100), @dSQL nvarchar(MAX)
    set @dSQL = 'exec @res = TestSP '''+@parm1+''','' '''+@parm2+' '' '
    print @dSQL
      EXECUTE sp_executesql @dSQL, N'@res varchar(100) OUTPUT', @res = @result OUTPUT
    select @result
    A complicated way of saying
    EXEC @ret = TestSP @parm1, @parm2
    SELECT @ret
    And not only compliacated, it introduces a window for SQL injection.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Calling stored procedures with parameters with the Database Connectivi​ty Toolkit

    Hi all,
    I am new to the forum and am having difficulty finding a solution to a particular problem I am having regarding using the LabVIEW Database Connectivity Toolkit on a project I am currently working on at my job.  I have a database in which I have tables and stored procedures with parameters.  Some of these stored procedures have input, output, and return parameters.
    I have been trying to follow this example but to no avail:  http://digital.ni.com/public.nsf/allkb/07FD1307460​83E0686257300006326C4?OpenDocument
    One such stored procedure I am working on implementing is named "dbo.getAllowablePNs", which executes "SELECT * from DeviceType" (DeviceType is the table).  In this case, it does not require an input parameter, it has an output parameter that generates the table [cluster], and has a return parameter which returns an integer value (execution status code) to show if an error occurred.  The DeviceType table has 3 columns; ID (PK, int, not null), PN (nvarchar(15), null), and NumMACAddresses (int, null).  I have gone over many examples and have talking to NI support to try to implement this and similar stored procedures in LabVIEW but have not been successful.  I am able to connect to the database with the Open Connection VI without error, but am running into some confusion following this step.  I am then trying to use the Create Parameterized Query VI to call the stored procedure and set the parameters.  I assume I would then use the Set Parameter Value VI for each parameter that is wired into the parameters input on the previous Parameterized Query VI?  I am also having some confusion during and following these steps as well.  I would greatly appreciate any advice or suggestions anyone might have in regards to this situation as I am not a SQL expert.  Also, I would be happy to provide any more information that would be helpful.
    Regards,
    Jon
    Solved!
    Go to Solution.

    Also, I don't know if this would be helpful but here is the actual stored procedure in SQL:
    CREATEPROCEDURE [dbo].[getLastSequenceNumber]
    @p1 nvarchar(10)='WO-00000'
    AS
    BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SETNOCOUNTON;
    -- Insert statements for procedure here
    selectmax(SequenceNumber)from Devices where WorkOrderNumber= @p1
    END
    GO

  • Calling Stored procedure with Parameters in PowerPivot DataModel

    Hi All,
    I wanted to call a SQL stored procedure from PowerPivot(Excel) on based on changing slicer's value. 
    Currently, we can call stored procedure wihtout any parameter from Data Model tab using 
    Exec stored_proc_name in Table Properties window.
    What if I want to call the same procedure with a parameter whouse value will come by changing slicer's value. I  meant, changing slicer value will act as a parameter to that stored procedure & it should return updated results. 
    Is this possible in PowerPivot?

    Hi Rameshwar,
    According to your description, you call a SQL Server stored procedure in PowerPivot data model, now the problem is that you need to pass a parameter to the stored procedure, right?
    Based on my research, it seems that we cannot achieve this requirement directly in current version of PowerPivot data model. Here is a similar thread for you reference.
    https://social.msdn.microsoft.com/Forums/sqlserver/en-US/5350228d-bc62-4a3b-a1a6-e847483e2858/powerpivot-for-excel-2013-call-execute-stored-procedure-with-parameters?forum=sqlkjpowerpivotforexcel
    If you have any concern about this behavior, you can submit a feedback at
    http://connect.microsoft.com/SQLServer/Feedback and hope it is resolved in the next release of service pack or product. Your feedback enables Microsoft to make software and services the best that they can be, Microsoft might consider to add this feature
    in the following release after official confirmation.
    Regards,
    Charlie Liao
    TechNet Community Support

  • Creating Web service for PL/SQL Procedure with Complex Data Types

    I need to created web service for PL/SQL Procedure with Complex Data types like table of records as parameters, how do we map the pl/sql table type parameters with web service, how to go about these?

    Hello,
    When you are creating a service from a Stored Procedure, the OracleAS WS tools will create necessary Java and PL wrapper code to handle the complex types (table of record) properly and make them compatible with XML format for SOAP messages.
    So what you should do is to use JDeveloper or WSA command line, to create a service from your store procedure and you will see that most of the work will be done for you.
    You can find more information in the:
    - Developing Web Services that Expose Database Resources
    chapter of the Web Service Developer's guide.
    Regards
    Tugdual Grall

  • How to call sql procedure with parameter from java

    Hello,
    i am trying to call one sql procedure with two parameters from java.
    the first parameter is In parameter, the second is OUT.
    the return value of this java method should be this second parameter value.
    the following is my java code:
    protected String getNextRunNumber() {
         String runnumber=null;
         String sql = "{call APIX.FNC_SST_EXPORT.GET_NEXT_RUNNUMBER (?,?)}";
    CallableStatement state = null;
    try{
         Connection con= getDatabaseConnection();
         state = con.prepareCall(sql);
         state.setString(1, m_appKeyExport);
         state.registerOutParameter(2,Types.NUMERIC,0);
         state.execute();
    ResultSet resultR = (ResultSet)state.getObject(2);
         while (resultR.next()) {
              runnumber=resultR.getBigDecimal(1).toString();
    catch (SQLException e){System.out.println("You can not get the export next run number properly");}
    return runnumber;
    i got error message like:
    java.lang.ClassCastException: java.math.BigDecimal
    As far as i knew, if the parameter is number or decimal, we should give also the paramer scale to the method: state.registerOutParameter(), but i still get this error message.
    Please help me to solve this problem.
    Thanks a lot.

    state.execute();
    i try to use debug to find the problem, in this line, i saw
    OracleCallableStatement(OraclePreparedStatement).execute() line: 642 [local variables unavailable]
    is this the problem?

  • Unable to debug procedure with parameters

    I have created following dummy procedure to reproduce my problem
    create or replace
    procedure dummy_proc (p_no number, p_name varchar2)
    is
    v_date date;
    begin
    select sysdate into v_date from dual;
    end;
    I am following these steps for debugging
    1. Open procedure in edit mode
    2. Compile it for debug with an icon “compile for debug”
    3. Add breakpoint on select.
    4. Click on lady bug icon to start debugging.
    5. Parameter window pop-up with following pop-up error message i.e.
    An error was encountered performing the requested operation:
    Fail to convert to internal representation
    Vendor code *17059*
    What I understand about problem is:
    It is related to data type conversion of parameters. When Oracle SQL Developer tries to create anonymous PL/SQL block for debugging any procedure with parameters it does not able to translate parameters data types properly. I have checked Tool--> Preferences -- > Debugger but did not find any help. Any one who could able to solve this issue?

    Dear K,
    What I understand from your reply is. This is not Oracle SQL Developer issue is this issue with Oracle configuration?
    Tell me would you able to debug procedures with parameters? Parameter window would successfully generate anonymous pl/sql block with correct data type translation?
    I have noticed one more thing kindly see this might give you any clue to solve my issue.
    DECLARE
    v_Return UNKOWN TYPE;
    BEGIN
    v_Return := db_dummy_pkg.set_dummy_date();
    -- Modify the code to output the variable
    -- DBMS_OUTPUT.PUT_LINE('v_Return = ' || v_Return);
    END;
    This PL/SQL block is generated by OSD for a procedure, not function, without parameters. I have to edit it like following to move on with debugging.
    BEGIN
    db_dummy_pkg.set_dummy_date();
    END;
    It means Oracle SQL Developer might not configure to understand data types like number, varchar2 in debugging mode only. Kindly see above bold text
    kind regards,
    Vitality

  • Reporting off oracle stored procedure with parameters error

    Erorr message: Error in File xxx.rpt: Failed to retrieve data from the database. Details: [Database Vendor Code: 907 ]
    Asp.net 2.0 web application.
    CR XI R2 sp2 in BOE XI R2 sp2 on Solaris 10.
    Database: Oracle 10g on Solaris 10. Oracle stored procedure defined in package.
    Happens with reports reporting off stored procedure with parameters.
    The sp is used in the crystal report.
    The web application passes parameters to crystal report, which then passes the parameters to stored procedure.
    Encountered error if:
    r.PromptOnDemandViewing = false;
    r.UseOriginalDataSource = false;
    r.CustomServerType = CeReportServerType.ceServerTypeOracle;
    Report can retrieves data if:
    r.PromptOnDemandViewing = false;
    r.UseOriginalDataSource = true;
    r.CustomServerType = CeReportServerType.ceServerTypeOracle;
    In addition
    The steps are:
    1)     Create oracle package and stored proc.
    2)     In CR Designer, select the stored proc as datasource.
    3)     The parameters names were "generated" by the CR Designer.
    4)     Rename the parameter names.
    5)     Drag the fields onto report.
    We noticed the following with different setting of database logon info:
    When previewing from BOE, get error when "Use custom database logon information specified here"
    However, no error when "Use original database logon information from the report". 
    Am i missing something?

    Please re-post if this is still an issue to the Data Connectivity - Crystal Reports Forum or purchase a case and have a dedicated support engineer work with you directly

  • PL/SQL Procedures with the same name

    Hi,
    I have some PL/SQL procedures with the same name but different arguments.
    If I try to catalog the second or third ALBPM always catalogs the first and I don't want to use this. ALBPM only catalogs the first one.
    ALBPM Studio Logs:
    Introspecci?n en curso...
    Agregando procedimiento 'ADM_SGI.UGDIASINOI'
    Agregando procedimiento 'ADM_SGI.UGDIASINOI'
    Agregando procedimiento 'ADM_SGI.UGDIASINOI'
    [Advertencia] No se puede agregar procedimiento 'UGDIASINOI'. Motivo: Duplicar nombre del componente (M?dulo DatabaseRoot.ADM_SGI - Componente UGDIASINOI)..
    [Advertencia] No se puede agregar procedimiento 'UGDIASINOI'. Motivo: Duplicar nombre del componente (M?dulo DatabaseRoot.ADM_SGI - Componente UGDIASINOI)..
    Analizando componentes
    Any solution or idea??
    Thanks!

    I need to retrive data from PL/SQL stored procedures. I am using the DynamicSQL component (2nd workaround) to retrive data from PL/SQL stored procedures. <br><br>
    I am having some problems.<br><br>
    This is the code I am running in Fuego Studio 5.5 SP 11 Build #71108:<br><br>
    dynamicSQL as Fuego.Sql.DynamicSQL<br>
    iterator as Iterator(Any[Any])<br>
    sentence as String<br>
    implname as String<br><br>
    dynamicSQL = Fuego.Sql.DynamicSQL()<br>
    implname = "conexionORBPAU"<br>
    sentence = "var result REFCURSOR; " + <br>
    "exec :result_cursor := pkg_audbpm_bpaasig_indicador.prgetsingle(9999);";<br>
    iterator = executeQuery(DynamicSQL, sentence, implname, inParameters : []);<br><br>
    And, this is the error:<br><br>
    java.sql.SQLException: Falta el parametro IN o OUT en el indice:: 1 <br>
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)<br>      at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)<br>
    oracle.jdbc.driver.OraclePreparedStatement.processCompletedBindRow(OraclePreparedStatement.java:1681)<br>
         at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3280)<br>
         at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3329)<br>
         at fuego.jdbc.FaultTolerantPreparedStatement.executeQuery(FaultTolerantPreparedStatement.java:579)<br>
         at fuegoblock.sql.DynamicSQL.executeQuery(DynamicSQL.java:340)<br>
    ...<br><br>
    This is the code of the PL/SQL in the Oracle DB:<br><br>
    CREATE OR REPLACE PACKAGE PKG_AUDBPM_BPAASIG_INDICADOR IS<br>
    TYPE cursor_type IS REF CURSOR;<br>
         FUNCTION prGetSingle<br>
         (<br>
              p_ID_ASIG_INDICADOR IN NUMBER<br>
         )<br>
         RETURN cursor_type;<br><br>
    END PKG_AUDBPM_BPAASIG_INDICADOR;<br><br>
    is my code OK? Any ideas?<br><br>
    Thanks in advance.<br>

  • OCCI call PL/SQL Procedure with 2 IN/OUT Parameters..BUS ERROR!!

    Hi~ All,
    I am new user for using OCCI. Util now, I encountered a problem with OCCI when I call a procedure with 2 IN/OUT parameters. Then,I got an error(core dump), Why?
    CREATE OR REPLACE PROCEDURE demo_proc (v1 in integer, v2 in out varchar2, v3 in out varchar2);
    ==== OCCI Code ========
    stmt = conn->createStatement
    ("BEGIN demo_proc(:v1, :v2, :v3); END;");
    cout << "Executing the block :" << stmt->getSQL() << endl;
    stmt->setInt (1, 10);
    stmt->setString (2, "Test1");
    stmt->setString (3, "First");
    int updateCount = stmt->executeUpdate ();
    cout << "Update Count:" << updateCount << endl;
    cout << "Printing the INOUT & OUT parameters:" << endl;
    string c1 = stmt->getString (2);
    cout << c1 << endl;
    string c2 = stmt->getString (3);
    ==== RUN RESULT ====
    Bus error(coredump)
    But, If i just only got one of string from v1 or v2,I could get correct result!! Why? Does some one know how to avoid this two IN/OUT parameters issue?

    Hi~ Amoghavarsha,
    Thanks for your response! I solved the problem by myself. I found the root cause, it seems very strange in
    initializing environment variable.
    === FAILED ===
    Environment *env;
    === SUCCESS ===
    Environment *env = NULL; <---Why??
    cout << "occidml - createEnvironment" << endl;
    env = Environment::createEnvironment (Environment::OBJECT);
    Eventually, I fixed this issue in Win2K and HP-UX 11.
    Best Regards,

  • Call stored procedure(with parameters) via odbc

    In my application I like to use the below statement to call a stored procedure with parameter and return a result set.
    {CALL PP.getPerson('daniel')}
    but this will just return errors to my application.
    If I change the statement to:
    {CALL PP.getPerson(?')}
    and bind a parameter and its value, it will work.
    My question is, is it possible to call a stored procedure via ODBC without binding parameters in application? I mean, what will be my SQL equivalent if I don't want to do parameter binding in my application?
    Thanks in advance. I appreciate any help :-)

    hi 
    Please see the e.g bellow
    create proc proc_test(@SchoolNumber int,@SchoolName
    varchar(100),@StudentNumber int, @StudnentName
    varchar(100)output ,
    @StudentAddress varchar(100) output,
    @Studentbirthdate datetime output,
    @StudentPhoneNumber varchar(100) output,
    @GuardianName varchar(100) output)
    as
    begin
    select @StudnentName varchar=StudnentName ,
    @StudentAddress =StudentAddress,
    @Studentbirthdate =Studentbirthdate ,
    @StudentPhoneNumber =StudentPhoneNumber,
    @GuardianName =GuardianName
    from table where schoolno=@SchoolNumber
    and SchoolName=@SchoolName
    and StudentNumber=@StudentNumber
    return
    end
    http://technet.microsoft.com/en-us/library/ms187004(v=sql.105).aspx
    http://www.lynda.com/SQL-Server-tutorials/Using-input-output-parameters/104964/113058-4.html
    Please mark answered if I've answered your question and vote for it as helpful to help other user's find a solution quicker

  • Calling ORACLE Store Procedure with parameters in user define function

    Hi everybody,
    We have a scenario connecting Oracle DB thru JDBC adapter.
    We have to call store procedure with input parameter and output parameter to retrieve data from DB. The implementation was made using JDBC adapter by building the correct XML message with EXECUTE action, and it works fine.
    Now we need to use DB lookup within mapping. I wrote users define function with SELECT statement (using the JDBC adapter) and it works fine but I need to call store procedure in ORACLE instead of SELECT statement.
    I found lot of examples concerning DB lookup but none of them explained how to write UDF calling store procedure in ORACLE with input and output parameters.
    I am looking for an example.
    Thanks in advance,
    Gigi

    I agree with you, but issue is we have lots of existing store procedure, which we need to call where damn required. I am sure those will be few but still i need to find out.
    If you think you are going to get existing MS Stored Procedures  or Oracle Packages that had nothing to do with the ORM previously to work that are not geared to do simple CRUD operations with the ORM and the database tables, you have a rude awakening
    coming that's for sure. You had better look into using ADO.NET and Oracle Command objects and call those Oracle Packages by those means and use a datareader.
    You could use the EF backdoor, call Oracle Command object and use the Packages,  if that's even possible, just like you can use MS SQL Server Stored Procedures or in-line T-SQL via the EF backdoor.
    That's about your best shot.
    http://blogs.msdn.com/b/alexj/archive/2009/11/07/tip-41-how-to-execute-t-sql-directly-against-the-database.aspx

  • JDBC receiver adapter to call MS SQLServer stored procedure with parameters

    We are trying to use the JDBC receiver adapter to call a stored procedure in MS SQLServer with parameters.  According to the help documentation for the JDBC receiver adapter for action=EXECUTE,  "The elements within the stored procedure are interpreted as parameters" and "The parameter names must be identical to those of the stored procedure definition".  The parameters within a MS SQLServer stored procedure are required to begin with the '@' symbol.  The element names within a XML document i.e. used to call the stored procedure can not contain a special character such as '@' in the first position.  For all of the tests we have done where the parameter name in the XML document omits the '@' character, the parameters are not being received by the stored procedure.  Is there a way around this  problem?
    Thank you,
    Harold

    Hello Harold - I am facing the EXACTLY SAME problem.Pls let me know how did you fix this problem ?
    This is the message I am passing on to the DB SP:
    <?xml version="1.0" encoding="UTF-8"?>
    <MRIRequestInbound>
       <StatementName>
          <prc_FC_InsertStagingJournalEntries action="EXECUTE"/>
          <JournalData isInput="true" type="STRING">
    <NewDataSet><Table ITEM = "" ENTITYID = "" PERIOD = "" ACCTNUM = "" DEPARTMENT = "" JOBCODE = "" AMT = "" REF = "" DESCRPN = "" ENTRDATE = "" BASIS = " " BALFOR = "N" REQUESTNUM = "" ACCTNAME = "" TYPE = "" DESCRPTN = "" GDEP_DESCRPN = "" GJOB_DESCRPTN = "" JOBTYPE = ""  /></NewDataSet>
    </JournalData>
       </StatementName>
    </MRIRequestInbound>
    Out of which,
    <NewDataSet> tag contains the value of the parameter in the SP. So, my value to the SP's parameter is :
    <NewDataSet><Table ITEM = "" ENTITYID = "" PERIOD = "" ACCTNUM = "" DEPARTMENT = "" JOBCODE = "" AMT = "" REF = "" DESCRPN = "" ENTRDATE = "" BASIS = " " BALFOR = "N" REQUESTNUM = "" ACCTNAME = "" TYPE = "" DESCRPTN = "" GDEP_DESCRPN = "" GJOB_DESCRPTN = "" JOBTYPE = ""  /></NewDataSet>
    Any clue ?
    Cheers,
    Amrish.

  • Calling Stored Procedure with parameters from a C program

    Hello, I need to call a PL/SQL stored procedure from a C program.
    Something like this sample program provided by Oracle -
    main()
    int i;
    EXEC SQL BEGIN DECLARE SECTION;
    */* Define type for null-terminated strings. */*
    EXEC SQL TYPE asciz IS STRING(20);
    asciz  username[20];
    asciz  password[20];
    int    dept_no;    / which department to query */*
    char   emp_name[10][21];
    char   job[10][21];
    EXEC SQL VAR emp_name is STRING (21);
    EXEC SQL VAR job is STRING (21);
    float  salary[10];
    int    done_flag;
    int    array_size;
    int    num_ret;    / number of rows returned */*
    int    SQLCODE;
    EXEC SQL END DECLARE SECTION;
    */* Connect to Oracle. */*
    strcpy(username, "SCOTT");
    strcpy(password, "TIGER");
    EXEC SQL WHENEVER SQLERROR DO sqlerror();
    EXEC SQL CONNECT :username IDENTIFIED BY :password;
    printf("Enter department number: ");
    scanf("%d", &dept_no);
    fflush(stdin);
    */* Set the array size. */*
    array_size = 10;
    done_flag = 0;
    num_ret = 0;
    */* Array fetch loop - ends when NOT FOUND becomes true. */*
    EXEC SQL EXECUTE
    BEGIN personnel.get_employees
    *(:dept_no, :array_size, :num_ret, :done_flag,*
    *:emp_name, :job, :salary);*
    END;
    END-EXEC;
    The question is - how is the Stored procedure get_employees declared ? Or more specifically, how is the salary parameter declared in get_employees ? Any help is highly appreciated.

    Hope following will help
    NOTE: Not tested
    Calling a stored procedure
    This program connects to ORACLE using the SCOTT/TIGER
    account. The program declares several host arrays, then
    calls a PL/SQL stored procedure (GET_EMPLOYEES in the
    CALLDEMO package) that fills the table OUT parameters. The
    PL/SQL procedure returns up to ASIZE values.
    It keeps calling GET_EMPLOYEES, getting ASIZE arrays
    each time, and printing the values, until all rows have been
    retrieved. GET_EMPLOYEES sets the done_flag to indicate "no
    more data."
    #include <stdio.h>
    #include <string.h>
    EXEC SQL INCLUDE sqlca.h;
    typedef char asciz[20];
    typedef char vc2_arr[11];
    EXEC SQL BEGIN DECLARE SECTION;
    /* User-defined type for null-terminated strings */
    EXEC SQL TYPE asciz IS STRING(20) REFERENCE;
    /* User-defined type for a VARCHAR array element. */
    EXEC SQL TYPE vc2_arr IS VARCHAR2(11) REFERENCE;
    asciz username;
    asciz password;
    int dept_no; /* which department to query? */
    vc2_arr emp_name[10]; /* array of returned names */
    vc2_arr job[10];
    float salary[10];
    int done_flag;
    int array_size;
    int num_ret; /* number of rows returned */
    EXEC SQL END DECLARE SECTION;
    long SQLCODE;
    void print_rows(); /* produces program output */
    void sql_error(); /* handles unrecoverable errors */
    main()
    int i;
    char temp_buf[32];
    /* Connect to ORACLE. */
    EXEC SQL WHENEVER SQLERROR DO sql_error();
    strcpy(username, "scott");
    strcpy(password, "tiger");
    EXEC SQL CONNECT :username IDENTIFIED BY :password;
    printf("\nConnected to ORACLE as user: %s\n\n", username);
    printf("Enter department number: ");
    gets(temp_buf);
    dept_no = atoi(temp_buf);/* Print column headers. */
    printf("\n\n");
    printf("%-10.10s%-10.10s%s\n", "Employee", "Job", "Salary");
    printf("%-10.10s%-10.10s%s\n", "--------", "---", "------");
    /* Set the array size. */
    array_size = 10;
    done_flag = 0;
    num_ret = 0;
    /* Array fetch loop.
    * The loop continues until the OUT parameter done_flag is set.
    * Pass in the department number, and the array size--
    * get names, jobs, and salaries back.
    for (;;)
    EXEC SQL EXECUTE
    BEGIN calldemo.get_employees
    (:dept_no, :array_size, :num_ret, :done_flag,
    :emp_name, :job, :salary);
    END;
    END-EXEC;
    print_rows(num_ret);
    if (done_flag)
    break;
    /* Disconnect from the database. */
    EXEC SQL COMMIT WORK RELEASE;
    exit(0);
    void
    print_rows(n)
    int n;
    int i;
    if (n == 0)
    printf("No rows retrieved.\n");
    return;
    for (i = 0; i < n; i++)
    printf("%10.10s%10.10s%6.2f\n",
    emp_name, job[i], salary[i]);
    /* Handle errors. Exit on any error. */
    void
    sql_error()
    char msg[512];
    int buf_len, msg_len;
    EXEC SQL WHENEVER SQLERROR CONTINUE;
    buf_len = sizeof(msg);
    sqlglm(msg, &buf_len, &msg_len);
    printf("\nORACLE error detected:");
    printf("\n%.*s \n", msg_len, msg);
    EXEC SQL ROLLBACK WORK RELEASE;
    exit(1);
    Remember, the datatype of each actual parameter must be convertible to the datatype of its corresponding formal parameter. Also, before a stored procedure is exited, all OUT formal parameters must be assigned values. Otherwise, the values of corresponding actual parameters are indeterminate.
    SQLCHECK=SEMANTICS is required when using an anonymous PL/SQL block.

  • Running SQL Procedure with dg4msql errors: Function sequence error HY010

    I am trying to execute a stored procedure on a SQL database and get the error Function sequence error HY010.
    A simple query on a table returns teh expected result.
    I have a single Win2008R2 server with MSSQL Express 2008 and Oracle 11gR2 (32bit not 64bit version of Oracle)
    Below is the gateway init, listener and tnsnames files and the query I am trying to run:
    -- initORIONWASP.ora --
    HS_FDS_CONNECT_INFO=INGRDB//waspForGIS
    HS_FDS_TRACE_LEVEL=OFF
    HS_FDS_RECOVERY_ACCOUNT=RECOVER
    HS_FDS_RECOVERY_PWD=RECOVER
    HS_CALL_NAME=dbo.spTest;dbo.spQueryAsset;dbo.spQueryAssetDetails
    HS_FDS_PROC_IS_FUNC=TRUE
    HS_FDS_RESULTSET_SUPPORT=TRUE
    -- Listener.ora -- (partial)
    (SID_DESC =
    (SID_NAME = ORIONWASP)
    (ORACLE_HOME = C:\Oracle\product\11.2.0\dbhome_1)
    (PROGRAM=dg4msql)
    -- tnsnames.ora -- (partial)
    ORIONWASP =
    (DESCRIPTION=
    (ADDRESS=(PROTOCOL=tcp)(HOST=INGRDB)(PORT=1521))
    (CONNECT_DATA=(SID=ORIONWASP))
    (HS=OK)
    -- Simple Query --
    Running select "Asset_ID" from asset@ORIONWASP; returns the correct result
    Running select * from sys.procedures@ORIONWASP; returns a list of procedures including the procedure I want to run
    -- This pl/sql block returns the error ******* identifier 'spTest@ORIONWASP' must be declared *******
    declare
    begin
    "spTest"@ORIONWASP;
    end;
    -- This passthrough pl/sql block returns ******** [Oracle][ODBC SQL Server Driver]Function sequence error {HY010} ********
    DECLARE
    CRS BINARY_INTEGER;
    RET BINARY_INTEGER;
    v_COL1 VARCHAR2(50);
    v_COL2 VARCHAR2(50);
    BEGIN
    CRS := DBMS_HS_PASSTHROUGH.OPEN_CURSOR@ORIONWASP;
    DBMS_HS_PASSTHROUGH.PARSE@ORIONWASP(CRS, 'exec spTest');
    BEGIN
    RET := 0;
    WHILE (TRUE)
    LOOP
    ret := DBMS_HS_PASSTHROUGH.FETCH_ROW@ORIONWASP(CRS, FALSE);
    DBMS_HS_PASSTHROUGH.GET_VALUE@ORIONWASP(CRS, 1, v_COL1);
    DBMS_HS_PASSTHROUGH.GET_VALUE@ORIONWASP(CRS, 2, v_COL2);
    DBMS_OUTPUT.PUT_Line('Col1:'||v_COL1||' Col2:'||v_COL2);
    END LOOP;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    BEGIN
    DBMS_OUTPUT.PUT_LINE('End of Fetch');
    DBMS_HS_PASSTHROUGH.CLOSE_CURSOR@ORIONWASP(CRS);
    END;
    END;
    END;
    /

    The gateway configuration file contains:
    HS_FDS_PROC_IS_FUNC=TRUE
    HS_FDS_RESULTSET_SUPPORT=TRUE
    This setting commonly causes problems and you need to set
    HS_FDS_PROC_IS_FUNC=TRUE
    HS_FDS_RESULTSET_SUPPORT=FALSE
    for normal procedure calls and
    HS_FDS_PROC_IS_FUNC=FALSE
    HS_FDS_RESULTSET_SUPPORT=TRUE
    when calling the procedure with ref cursors.
    There's a note in My Oracle Support that gives you examples how to call remote SQl Server procedures
         Note.197192.1 Different Methods How To Call MS SQL Server Procedures Using TG4MSQL - DG4MSQL
    and another one for the Sybase gateway but this code is similar for the SQL Server:
    Article-ID: Note 351400.1
    Title: How to Call a Remote Sybase Procedure Using TG4SYBS

Maybe you are looking for

  • How can I hold a frame of a clip?

    I want to hold the first frame of a clip, then play the clip, then hold the last frame. Seems like there's some time remapping tools somewhere but I can't figure this out. I can't just take a screen shot and set that as the still because this is one

  • SharePoint DatePicker is not working in Visual webpart

    Hi, The sharepoint date picker is not working for Visual webparts created in VS 2012 (SP 2013). In my visual webpart, I added the form digest, and then the sharePoint date control. <script type="text/javascript" src="/_layouts/15/datepicker.js"></scr

  • Header and Footer Questions

    Hello. Can anyone explain what exactly the purpose of the header and footer sections are in iWeb? I would understand if content placed in the header or footer showed up on all pages of a site. That would be very useful, but it doesn't seem to be the

  • HT1363 still cant get my ipod to be recognized by itunes or the PC

    my iphone 5s does come up on PC but not on itunes 11.1.1

  • Search help in dynpro

    Hi to all, In my application I have a field with a search help. I want that this field only can be modified using a search help and this field can't be modified directly writing in this field. Is similar to transaction se63 - Translation - Abap objec