Executing a Procedure with IN and OUT parameters

How do I call/execute the following procedure? When I call as Courses(StartDate,EndDate,nCount,State,LastUpdate);
I get an error:
Error(92,45): PLS-00363: expression 'nCount' cannot be used as an assignment target
Error(92,55): PLS-00363: expression 'State' cannot be used as an assignment target
PROCEDURE  Courses
   StartDate       IN             VARCHAR2
,  EndDate        IN             VARCHAR2
,  nCount           IN OUT   VARCHAR2
,  State               IN OUT   CHAR
,  LastUpdate   IN             DATE

set serverout on
declare
   l_StartDate    VARCHAR2(100) := '20130101';  -- why are you using varchar? use a date! you WILL regret using a string eventually
   l_EndDate      VARCHAR2(100) := '20140101';
   l_Count        VARCHAR2(100);   -- string, again? why? isn't a count a number?
   l_State        VARCHAR2(100);
   l_LastUpdate   DATE     :=  sysdate;
begin
   Courses ( l_StartDate, l_EndDate, l_Count, l_State, l_LastUPdate );
   dbms_output.put_line ( 'Count: ' || l_Count );
   dbms_output.put_line ( 'State: ' || l_State );
end;

Similar Messages

  • 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,

  • Can Stored procedure with IN and OUT Paramter can be used in JDBC LOOKUP?

    can Stored procedure with IN and OUT Paramter can be used in JDBC LOOKUP?

    Checking online help, I do not see any possibility.
    "Queries a data base by the given SQL statement."
    http://help.sap.com/javadocs/pi/pi711sp03/com/sap/aii/mapping/lookup/DataBaseAccessor.html
    -> execute

  • Error while executing procedure having IN and OUT parameters

    Hi,
    I will be really gratified if someone can please help me in solving with the following problem.
    I have one procedure given below
    create or replace procedure abcd1april (
                                            nd_in                IN varchar2,
                                            sal_in           IN number,
                                            success_out      OUT number,
                                            error_code_out OUT number,
                                            error_msg_out      OUT varchar2
    AS
    old_sal number;
    cursor H7 is select SERV_ACC_LINK_CODE_N from pair_bkup where PAIRE_STATUS in (3,4) and nd=nd_in;
    BEGIN
         old_sal:=0;
         open H7;
         fetch H7 into old_sal;
         close H7;
         if old_sal=0
         then
              success_out:=0;
              error_code_out:=01;
              error_msg_out:='Check this error';
         else
                   update pair_bkup set SERV_ACC_LINK_CODE_N=sal_in where nd=nd_in and SERV_ACC_LINK_CODE_N=old_sal;
         success_out:=1;
              error_code_out:=00;
              error_msg_out:='NO ERROR IS THERE';
         end if;
    EXCEPTION
              WHEN OTHERS
              THEN
              success_out:=0;
              error_code_out:=SQLCODE;
              --error_msg_out:=SQLERRM;                                                                                                                 
    END;     
    Now when i try to execute this script it throws an error given below:-
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    ORA-06512: at "TELMATEST.ABCD1APRIL", line 39
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    Now i am executing this procedure by following script:-
    DECLARE
              nd_in_n VARCHAR2(10);
              sal_in_n NUMBER;
              success_out_n NUMBER;
              error_code_out_n NUMBER;
              error_message_out_n VARCHAR2(10);
    BEGIN
         nd_in_n := '';
         sal_in_n:= 0;
         success_out_n := 0;
         error_code_out_n:= '';
         error_message_out_n := '';
    abcd1april('02022',3,success_out_n,error_code_out_n,error_message_out_n);
    insert into errormsgs values(&error_code_v,'error_message_v');
    END ;
    Now please help me in above case.
    Regards
    Gursimran Singh

    Gursimran,
    The error message tells you what you need to know -
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small.You're calling the procedure and supplying
    error_message_out_n VARCHAR2(10);In each case, the message 'Check this error', 'NO ERROR IS THERE' or SQLERRM is longer than 10 characters - therefore the error.
    Try it with
    error_message_out_n VARCHAR2(1000);Cheers,
    Bryan.

  • Create procedure with IN and  OUT, what is IN+OUT?

    Hi.
    from docs:
    IN
    Specify IN to indicate that you must supply a value for the argument when calling the procedure.
    OUT
    Specify OUT to indicate that the procedure passes a value for this argument back to its calling environment after execution.
    IN OUT
    Specify IN OUT to indicate that you must supply a value for the argument when calling the procedure and that the procedure passes a value back to its calling environment after execution.
    As I understand like in oop IN - passing parameter by value, out-by reference. But IN OUT? d:/

    Gets passed in with one value, comes out with another.
    create or replace procedure calcarea (x in out number)
    as
    begin
    x:=x*x;
    end;
    create or replace procedure output (oneside in number)
    as
    myinput number;
    area number;
    begin
    myinput := oneside;
    calcarea(myinput);
    dbms_output.put_line('The area in sq units is '||myinput);
    end;
    set serveroutput on
    exec output(5);Note how the area is passed out via the same parameter.

  • How to execute a procedure with Object as OUT parameter

    Hi,
    I have a procedure and it consists 2 parameter, one is an input parameter and that is some ID (NUMBER datatype) and 2nd parameter is an out parameter and it an Object type. I want to execute that procedure but not able to do the same. Can anyone please suggest me how do I execute a procedure which has got Object as an out parameter.
    Thanks a lot 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.

  • Procedure with IN and OUT date parameters

    Hello Guys,
    could you please tell me where i am doing wrong, i want to get or return the date from the below procedure. It is throwing below error when i try to execute it, appreciate your help.
    Execute Statement:
    exec get_nxt_trd_dt('09/03/2010')
    Error Message:
    PLS-00306: wrong number or types of arguments in call to 'GET_NXT_TRD_DT'
    Procedure Body:
    CREATE OR REPLACE PROCEDURE GET_NXT_TRD_DT
    (INPUT_DT IN DATE,OUTPUT_DT OUT DATE) IS
    BEGIN
    SELECT MIN(DATES) INTO OUTPUT_DT FROM (SELECT DISTINCT DATES FROM (
    SELECT * FROM
    SELECT TRUNC(TO_DATE(TO_CHAR(SYSDATE,'YYYYMMDD'),'yyyymmdd'),'Y')+ROWNUM -1 DATES FROM
    SELECT 1
    FROM Dual
    GROUP BY CUBE (2, 2, 2, 2, 2, 2, 2, 2, 2)
    WHERE ROWNUM <= ADD_MONTHS(TRUNC(TO_DATE(TO_CHAR(SYSDATE,'YYYYMMDD'),'YYYYMMDD'),'Y'),24) - TRUNC(TO_DATE(TO_CHAR(SYSDATE,'YYYYMMDD'),'YYYYMMDD'),'Y')
    WHERE TO_CHAR( DATES, 'DY') NOT IN ('SAT','SUN')
    MINUS
    SELECT DISTINCT HOLIDAY_DATE FROM HOLIDAY )
    WHERE DATES BETWEEN TO_DATE('08/01/2010','MM/DD/YYYY') AND TO_DATE('09/30/2010','MM/DD/YYYY')
    WHERE DATES > TO_DATE(INPUT_DT,'MM/DD/YYYY');
    END;

    That worked thank you. Could you please help on the below, how to execute the same plsql block defined as function?? Thank you.
    Execute stmts used:
    (1)
    DECLARE
    DT DATE;
    BEGIN
    GET_NXT_TRD_DT(TO_DATE('09/03/2010','MM/DD/YYYY'),DT);
    END;
    Error Message: PLS-00221: 'GET_NXT_TRD_DT' is not a procedure or is undefined
    (2)
    DECLARE
    BEGIN
    GET_NXT_TRD_DT(TO_DATE('09/03/2010','MM/DD/YYYY'));
    END;
    Error Message: PLS-00306: wrong number or types of arguments in call to 'GET_NXT_TRD_DT'
    Function Body:
    CREATE OR REPLACE FUNCTION GET_NXT_TRD_DT
    (INPUT_DT IN DATE,OUTPUT_DT OUT DATE) RETURN DATE IS
    BEGIN
    SELECT MIN(DATES) INTO OUTPUT_DT FROM (SELECT DISTINCT DATES FROM (
    SELECT * FROM
    SELECT TRUNC(TO_DATE(TO_CHAR(SYSDATE,'YYYYMMDD'),'yyyymmdd'),'Y')+ROWNUM -1 DATES FROM
    SELECT 1
    FROM Dual
    GROUP BY CUBE (2, 2, 2, 2, 2, 2, 2, 2, 2)
    WHERE ROWNUM <= ADD_MONTHS(TRUNC(TO_DATE(TO_CHAR(SYSDATE,'YYYYMMDD'),'YYYYMMDD'),'Y'),24) - TRUNC(TO_DATE(TO_CHAR(SYSDATE,'YYYYMMDD'),'YYYYMMDD'),'Y')
    WHERE TO_CHAR( DATES, 'DY') NOT IN ('SAT','SUN')
    MINUS
    SELECT DISTINCT HOLIDAY_DATE FROM HOLIDAY )
    WHERE DATES BETWEEN TO_DATE('08/01/2010','MM/DD/YYYY') AND TO_DATE('09/30/2010','MM/DD/YYYY')
    WHERE DATES > INPUT_DT;
    RETURN(OUTPUT_DT);
    END;
    /

  • Stored procedure with IN and OUT parameter

    HI all,
    here is code example
    declare
             in_dt date  := '1-feb-2010' ;
    col1 ...;
    col2 ...;
    col3 ...;       
    begin
      select e.*
      into col1,
            col2,
            col3
      from table_xyz e
      where e.start_dt  = in_dt;
    end;
    How do i convert the above code into stored procedure by accepting "in_dt" as IN parameter and getting the result set displayed (output) through OUT parameter say "cur_out" (OUT paramter)
    Thank you so much !!! I really appriciate it !!

    i ran my procedure which is very similar syndra posted
    create or replace procedure foo(p_dt in date, cv out sys_refcursor) as
    begin
    open cv for
    select e.*
    from table_xyz e
    where start_dt = p_dt;
    end;
    /Here is how is executed
    DECLARE
      P_DT DATE;
      CV SYS_REFCURSOR;
    BEGIN
      P_DT := '10-oct-2005';
      -- CV := NULL;  Modify the code to initialize this parameter
      scott.foo ( P_DT, CV );
      COMMIT;
    END;           
    -- i get PL/SQL procedure successfully complted , But i dont see the result set Or output
    - How do i see the output when i m using refcursor ?? i tried using print , but nothing didnt work
    - Any idea ??
    Thank you!!
    Edited by: user642297 on Jun 24, 2010 1:35 PM

  • WebService procedure with dbms_output.chararr OUT Parameters

    Hi everyone,
    I'm using Oracle native web service and everything work fine. Anyway, we want to return the data through string array , Is it possible?
    I already tried to create procedure as this script.
    P_INPUT1 VARCHAR2,
    P_INPUT2 VARCHAR2,
    Result OUT dbms_output.chararr
    Is it possible to wrap it as to web service because I cannot see the wsdl from this package or there are the limitation or any workaround to solve this problem.
    Thank and regards,
    zenoni

    Hi,
    Result OUT dbms_output.chararrUse SQL object types instead.
    For example :
    create or replace type my_collection is table of varchar2(4000);
    create or replace type my_ot is object ( list my_collection );
    create or replace procedure genList(p_val_max in number, result out my_ot)
    is
    begin
      -- return a collection of numeric strings from 1 to p_val_max
      select my_ot(
               cast(
                 multiset(
                   select to_char(level)
                   from dual
                   connect by level <= p_val_max
                 as my_collection
      into result
      from dual;
    end;
    /results in the following WSDL :
    <definitions name="GENLIST"
        targetNamespace="http://xmlns.oracle.com/orawsv/DEV/GENLIST"
        xmlns="http://schemas.xmlsoap.org/wsdl/"
        xmlns:tns="http://xmlns.oracle.com/orawsv/DEV/GENLIST"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
      <types>
        <xsd:schema targetNamespace="http://xmlns.oracle.com/orawsv/DEV/GENLIST"
         elementFormDefault="qualified">
          <xsd:element name="GENLISTInput">
            <xsd:complexType>
                <xsd:sequence>
                  <xsd:element name="RESULT-MY_OT-COUT">
                    <xsd:complexType/>
                  </xsd:element>
                  <xsd:element name="P_VAL_MAX-NUMBER-IN" type="xsd:double"/>
                </xsd:sequence>
              </xsd:complexType>
          </xsd:element>
          <xsd:element name="GENLISTOutput">
            <xsd:complexType>
                <xsd:sequence>
                  <xsd:element name="RESULT" type="tns:MY_OTType"/>
                </xsd:sequence>
              </xsd:complexType>
          </xsd:element>
          <xsd:complexType name="MY_OTType">
            <xsd:sequence>
              <xsd:element name="MY_OT">
                <xsd:complexType>
                  <xsd:sequence>
                    <xsd:element name="LIST">
                      <xsd:complexType>
                        <xsd:sequence>
                          <xsd:element name="VARCHAR2" type="xsd:string" maxOccurs="unbounded" minOccurs="0"/>
                        </xsd:sequence>
                      </xsd:complexType>
                    </xsd:element>
                  </xsd:sequence>
                </xsd:complexType>
              </xsd:element>
            </xsd:sequence>
          </xsd:complexType>
       </xsd:schema>
      </types>
      <message name="GENLISTInputMessage">
        <part name="parameters" element="tns:GENLISTInput"/>
      </message>
      <message name="GENLISTOutputMessage">
        <part name="parameters" element="tns:GENLISTOutput"/>
      </message>
      <portType name="GENLISTPortType">
      <operation name="GENLIST">
          <input message="tns:GENLISTInputMessage"/>
          <output message="tns:GENLISTOutputMessage"/>
        </operation>
      </portType>
      <binding name="GENLISTBinding"
               type="tns:GENLISTPortType">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
        <operation name="GENLIST">
          <soap:operation
    soapAction="GENLIST"/>
          <input>
            <soap:body parts="parameters" use="literal"/>
          </input>
          <output>
            <soap:body parts="parameters" use="literal"/>
          </output>
        </operation>
      </binding>
      <service name="GENLISTService">
        <documentation>Oracle Web Service</documentation>
        <port name="GENLISTPort" binding="tns:GENLISTBinding">
           <soap:address
                 location="http://localhost:8080/orawsv/DEV/GENLIST"/>
         </port>
      </service>
    </definitions>

  • How to write a shell script to execute a procedure with out parameter

    Hi,
    How to write a shell script to execute a procedure with out parameter.
    here is my procedure
    PROCEDURE sample(invar1 VARCHAR2,
    invar2 VARCHAR2,
    invar3 VARCHAR2,
    invar4 VARCHAR2,
    ecode out number);
    Any example really helpfull
    Thanks in advance

    Or if we're passing values in, maybe something like:
    Test procedure:
    CREATE OR REPLACE PROCEDURE p (myin IN VARCHAR2, myout OUT VARCHAR2)
    AS
    BEGIN
        myout :=
            CASE myin
                WHEN 'A' THEN 'APPLE'
                WHEN 'B' THEN 'BANANA'
                ELSE 'STARFRUIT'
            END;
    END;Shell script:
    #!/bin/bash
    my_shell_variable=$1
    unset ORACLE_PATH
    sqlplus -s un/pw@db <<-EOF
    set feedback off pause off
    set pagesize 0
    set autoprint off
    VAR out varchar2(30)
    VAR myin varchar2(30)
    exec :myin := '${my_shell_variable}'
    BEGIN
      p(:myin, :out);
    END;
    print out
    exit
    EOFTest:
    /Users/williamr: xx A
    APPLE
    /Users/williamr: xx B
    BANANA
    /Users/williamr: xx
    STARFRUITObviously in a real script you would not hardcode the password or let it show in a "ps" listing.
    Message was edited by:
    William Robertson

  • Execute a procedure with a list of array in sql server 2008

    HI all,
    I have a procedure which has a list of values passed as an array . How can i execute my procedure with array list? how to implement this?Please help me.
    Thanks in advance
    Deepa

    Hi Deepa,
    basically Microsoft SQL Server does not support arrays as data types for procedures. What you can do is creating a type which represents a table definition. This type can than be used in a procedure as the following demo will show:
    The first script creates the environment which will be used for the execution
    -- 1. create the table as a type in the database
    CREATE TYPE OrderItems AS TABLE
    ItemId int PRIMARY KEY CLUSTERED
    GO
    -- 2. demo table for demonstration of results
    CREATE TABLE dbo.CustomerOrders
    Id int NOT NULL IDENTITY (1, 1) PRIMARY KEY CLUSTERED,
    CustomerId int NOT NULL,
    ItemId int
    GO
    -- 3. Insert a few records in demo table
    INSERT INTO dbo.CustomerOrders
    (CustomerId, ItemId)
    VALUES
    (1, 1),
    (2, 1),
    (3, 3),
    (1, 3);
    GO
    -- 4. Create the procedure which accepts the table variable
    CREATE PROC dbo.OrderedItemsList
    @Orders AS OrderItems READONLY
    AS
    SET NOCOUNT ON;
    SELECT o.*
    FROM dbo.CustomerOrders AS O INNER JOIN @Orders AS T_O
    ON (o.ItemId = T_O.ItemId);
    SET NOCOUNT OFF;
    GO
    The above script creates the table data type and a demo table with a few demo data. The procedure will accept the table data type as parameter. Keep in mind that table variable parameters have to be READONLY as parameter for procedures!
    The second script demonstrates the usage of the above scenario
    When the environment has been created the usage is a very simple one as you can see from the next script...
    -- 1. Fill the variable table with item ids
    DECLARE @o AS OrderItems;
    INSERT INTO @o (ItemId)
    VALUES
    (1), (3);
    -- 2. Get the list of customers who bought these items
    EXEC dbo.OrderedItemsList @Orders = @o;
    MCM - SQL Server 2008
    MCSE - SQL Server 2012
    db Berater GmbH
    SQL Server Blog (german only)

  • Call from Java Plsql Procedure with VArray as Out Parameter

    Hi,
    I have a Java web application(Tomcat server) that call a plsql procedure with Varray as OUT parameter.
    The Plsql code is perfectly compiled.
    When i run the application, I get the following error msg in my Tomcat window:
    java.sql.SQLException: ORA-06530: Reference to uninitialized composite
    ORA-06512: at "SEMS1.PACK_SEMSADMIN_OFFEREDJOBS", line 102
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
    at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
    at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:573)
    at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1891)
    at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:109
    3)
    at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2047)
    at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1940)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2709)
    at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:589)
    at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStat
    {color:#0000ff}
    Doubt: Do I need to declare ArrayDescriptors to retrieve the VArray from the Plsql procedure.
    I think the below statement is enough; we need ArrayDescriptors only when we we wish to send a Plsql Object or Varray from Java code to the procedure. Plz correct me if not so.
    dbCallableStatement.execute();
    ARRAY SimpleOUTArray = (ARRAY) ((OracleCallableStatement) dbCallableStatement).
    getObject(Integer.parseInt(arlParameterOutIndex.get(i).toString()));{color}
    I am unable to realize where the mistake is?
    {color:#800000}
    {color}{color:#800000}
    VARRAY AND PROC DETAILS:
    TYPE STRUCT_JOB_DETAILS AS OBJECT
    APPL_NO NUMBER (10),
    S_FNAME VARCHAR2 (32 Byte),
    S_MI VARCHAR2 (32 Byte),
    S_LNAME VARCHAR2 (32 Byte),
    APPL_DATE DATE,
    DESCRIPTION VARCHAR2 (100 Byte),
    S_UCID VARCHAR2 (8 Byte)
    TYPE VARRAY_JOB_DETAILS IS VARRAY(100) OF STRUCT_JOB_DETAILS;{color}
    {color:#800000}PROCEDURE:{color}
    {color:#800000}CREATE OR REPLACE PACKAGE PACK_SEMSADMIN_OFFEREDJOBS
    AS
    TYPE Generic_Cursor_Type IS REF CURSOR;
    --TYPE varray_job_detail is VARRAY(100) OF STRUCT_JOB_DETAILS;
    --va_varray_job_detail varray_job_detail := varray_job_detail();
    va_varray_job_detail VARRAY_JOB_DETAILS := VARRAY_JOB_DETAILS();
    PROCEDURE Admin_Jobs_Offered_Rtr
    ic_status IN VARCHAR2,
    or_offered_jobs OUT Generic_Cursor_Type,
    va_varray_job_detail OUT VARRAY_JOB_DETAILS
    CREATE OR REPLACE PACKAGE BODY PACK_SEMSADMIN_OFFEREDJOBS
    AS
    PROCEDURE Admin_Jobs_Offered_Rtr
    ic_status IN VARCHAR2,
    or_offered_jobs OUT Generic_Cursor_Type,
    va_varray_job_detail OUT VARRAY_JOB_DETAILS
    AS
    vc_query VARCHAR2(15000) := '';
    vc_query_1 VARCHAR2(15000) := '';
    counter NUMBER := 1;
    vc_no NUMBER := 0;
    or_applicants_list Generic_Cursor_Type;
    TYPE type_appln_list IS RECORD
    job_no NUMBER(10),
    job_title VARCHAR2(50 BYTE),
    account_no VARCHAR2(10 BYTE),
    head_fname VARCHAR2(32 BYTE),
    head_minitial VARCHAR2(10 BYTE),
    head_lname VARCHAR2(32 BYTE),
    num NUMBER
    vn_appln_list type_appln_list;
    TYPE type_job_offered IS RECORD
    APPL_NO NUMBER (10),
    S_FNAME VARCHAR2 (32),
    S_MI VARCHAR2 (32),
    S_LNAME VARCHAR2 (32),
    APPL_DATE DATE,
    DESCRIPTION VARCHAR2 (100),
    S_UCID VARCHAR2 (8)
    vn_job_offered type_job_offered;
    BEGIN
    vc_query := vc_query || ' SELECT jobs.job_no,job_title, account_no, head_fname, head_minitial, head_lname, num';
    vc_query := vc_query || ' FROM jobs, ( ' ;
    vc_query := vc_query || ' SELECT jobs.job_no,count(*) as num' ;
    vc_query := vc_query || ' FROM student_apps ,jobs ' ;
    vc_query := vc_query || ' WHERE jobs.job_no = student_apps.job_no' ;
    vc_query := vc_query || ' AND (student_apps.status in (''o'',''t'')) '; --|| ic_status || ')' ;
    vc_query := vc_query || ' AND jobs.status not in (''z'', ''Z'')' ;
    vc_query := vc_query || ' GROUP BY jobs.job_no' ;
    vc_query := vc_query || ' ) no_apps_off' ;
    vc_query := vc_query || ' WHERE jobs.job_no = no_apps_off.job_no' ;
    dbms_output.put_line('Executed Query_1');
    va_varray_job_detail := VARRAY_JOB_DETAILS();
    va_varray_job_detail.extend(100);
    OPEN or_offered_jobs FOR vc_query;
    LOOP
    FETCH or_offered_jobs INTO vn_appln_list;
    EXIT WHEN or_offered_jobs%NOTFOUND;
    vc_query_1 := '';
    vc_query_1 := vc_query_1 || ' SELECT stud_apps.appl_no APPL_NO, stud_apps.s_fname S_FNAME, ';
    vc_query_1 := vc_query_1 || ' stud_apps.s_mi S_MI, stud_apps.s_lname S_LNAME, ';
    vc_query_1 := vc_query_1 || ' stud_apps.appl_date APPL_DATE, look_up.description DESCRIPTION, ' ;
    vc_query_1 := vc_query_1 || ' stud_apps.s_ucid S_UCID ' ;
    vc_query_1 := vc_query_1 || ' FROM student_apps stud_apps,jobs jbs,lookup look_up' ;
    vc_query_1 := vc_query_1 || ' WHERE stud_apps.status in (''o'',''t'') '; --(' || ic_status || ') ' ;
    vc_query_1 := vc_query_1 || ' AND jbs.job_no = stud_apps.job_no' ;
    vc_query_1 := vc_query_1 || ' AND jbs.status not in (''z '', ''Z'')' ;
    vc_query_1 := vc_query_1 || ' AND stud_apps.status = look_up.code ' ;
    vc_query_1 := vc_query_1 || ' AND look_up.type = ''st''' ;
    vc_query_1 := vc_query_1 || ' AND stud_apps.job_no = ''' || vn_appln_list.job_no || ''' ' ;
    vc_query_1 := vc_query_1 || ' ORDER BY appl_date' ;
    dbms_output.put_line('Executed Query_2');
    OPEN or_applicants_list FOR vc_query_1;
    LOOP
    FETCH or_applicants_list INTO vn_job_offered;
    EXIT WHEN or_applicants_list%NOTFOUND;
    va_varray_job_detail(counter).APPL_NO := vn_job_offered.APPL_NO;
    va_varray_job_detail(counter).S_FNAME := vn_job_offered.S_FNAME;
    va_varray_job_detail(counter).S_MI := vn_job_offered.S_MI;
    va_varray_job_detail(counter).S_LNAME := vn_job_offered.S_LNAME;
    va_varray_job_detail(counter).APPL_DATE := vn_job_offered.APPL_DATE;
    va_varray_job_detail(counter).DESCRIPTION := vn_job_offered.DESCRIPTION;
    va_varray_job_detail(counter).S_UCID := vn_job_offered.S_UCID;
    counter := counter + 1;
    END LOOP; --end of FOR
    CLOSE or_applicants_list;
    END LOOP; -- end of FETCH
    END Admin_Jobs_Offered_Rtr;
    END PACK_SEMSADMIN_OFFEREDJOBS;
    /{color}
    Reqire help plzzzz !!!
    Thanks.

    Originally posted by JDBC Development Team:
    It's very similar to other datatype except that it uses OracleTypes.ARRAY typecode and the value is mapped to a oracle.sql.ARRAY instance. The code looks as follows --
    cstmt.registerOutParameter (idx, OracleTypes.ARRAY, "VARRAY_TYPE_NAME_HERE");
    cstmt.execute ();
    ARRAY array = (ARRAY) cstmt.getObject (idx);
    Thanks for your reply.
    I have to use:-
    OracleCallableStatement cs1 = (OracleCallableStatement )conn.prepareCall
    ( "{call proj_array(?)}" ) ;
    for retrieving a collection as an OUT parameter.
    This gives me the errors:-
    C:\jdbc\VarraySQL.java:0: The method oracle.jdbc2.Blob getBlob(int) declared in class oracle.jdbc.driver.OracleCallableStatement cannot override the method of the same signature declared in interface java.sql.CallableStatement. They must have the same return type.
    import java.sql.*;
    ^
    C:\jdbc\VarraySQL.java:0: The method oracle.jdbc2.Array getArray(int) declared in class oracle.jdbc.driver.OracleCallableStatement cannot override the method of the same signature declared in interface java.sql.CallableStatement. They must have the same return type.
    import java.sql.*;
    ^
    C:\jdbc\VarraySQL.java:0: The method oracle.jdbc2.Clob getClob(int) declared in class oracle.jdbc.driver.OracleCallableStatement cannot override the method of the same signature declared in interface java.sql.CallableStatement. They must have the same return type.
    import java.sql.*;
    ^
    C:\jdbc\VarraySQL.java:0: The method oracle.jdbc2.Ref getRef(int) declared in class oracle.jdbc.driver.OracleCallableStatement cannot override the method of the same signature declared in interface java.sql.CallableStatement. They must have the same return type.
    import java.sql.*;
    ^
    How do I get rid of these errors?
    null

  • How can I execute Stored Procedures in PARALLEL and DYNAMICALLY ?

    Hi 
    I have a stored procedure. It can be executed like this
    exec test @p = 1;
    exec test @p = 2
    exec test @p = n;
    n can be hundred.
    I want the sp being executed in parallel, not sequence. It means the 3 examples above can be run at the same time.
    If I know the number in advance, say 3, I can create 3 different Execution SQL Tasks. They can be run in parallel.
    However, the n is not static. It is coming from a table. 
    How can I execute Stored Procedures in PARALLEL and DYNAMICALLY ?
    I think about using script task. In the script, I get the value of n, and the list of p, from the table, then running a loop with. In the loop, I create a threat and in the threat, I execute the sp like : exec test @p = p. So the exec test may
    be run parallel. But I am not sure if it works.
    Any idea is really appreciated.

    Hi nam_man,
    According to your description, you want to call stored procedures in parallel, right?
    In SSIS, we can create separate jobs with different stored procedures, then set the same schedule to kick the jobs off at the same time. In this way, we should be careful to monitor blocking and deadlocking depending on what the jobs are doing.
    We can also put all stored procedures in SSIS Sequence container, then they will be run in parallel.
    For more information about SSIS job and Sequence container, please refer to the following documents:
    http://www.mssqltips.com/sqlservertutorial/220/scheduling-ssis-packages-with-sql-server-agent/
    https://msdn.microsoft.com/en-us/library/ms139855(v=sql.110).aspx
    If you have any more questions, please feel free to ask.
    Thanks,
    Wendy Fu
    Wendy Fu
    TechNet Community Support

  • Stored procedure with cursor as out parameter

    Can any one help me by showing how to write a procedure with cursor as out parameter and caputuring it in java using jdbc.
    Thanks in advance,
    shravan bharadwaj

    I know that in the SQLJ distribution (which is also downloadable) there is an example in the demo directory called RefCursDemo that shows the SQL code and how to call it - albeit from SQLJ and not JDBC. There may also be a demo in the JDBC distribution, though I am not sure about that.

  • Please help - Can not use stored procedure with CTE and temp table in OLEDB source

    Hi,
       I am going to create a simple package. It has OLEDB source , a Derived transformation and a OLEDB Target database.
    Now, for the OLEDB Source, I have a stored procedure with CTE and there are many temp tables inside it. When I give like EXEC <Procedure name> then I am getting the error like ''The metadata  could not be determined because statement with CTE.......uses
    temp table. 
    Please help me how to resolve this ?

    you write to the temp tables that get created at the time the procedure runs I guess
    Instead do it a staged approach, run Execute SQL to populate them, then pull the data using the source.
    You must set retainsameconnection to TRUE to be able to use the temp tables
    Arthur My Blog

Maybe you are looking for

  • How to select text from a webpage

    hi. i have firefox for my n900. i would like to know how to select some text from a webpage so i can copy and paste it. thanks for the help. i couldn't it anywhere.

  • Custom iviews in HCM process and forms

    Hi , We are using EhP4 in ECC and E-Recruiting systems. We want to use the customized requisition request process in HCM Processes and Forms.We have developed a adobe interactive form with webdynpro for ABAP along with some workflow. I want to link t

  • Reload the intial screen !

    Hi All , I have a problem in webdynpro application. After running my application when iam getting the initial screen then user select some selected values and click the submit button then goto the next screen .In second screen i have a "back" Button.

  • Xcode crashes on startup

    Stacktrace: Process: Xcode [16889] Path: /Applications/Xcode.app/Contents/MacOS/Xcode Identifier: com.apple.Xcode Version: ??? (???) Build Info: DevToolsIDE-16100000~6 Code Type: X86-64 (Native) Parent Process: launchd [140] Date/Time: 2009-11-23 12:

  • Green lines on the edge of my video

    Hello, I have a problem with premiere pro cs6 every time I export my video I get weird green lines on the left and bottom sides of my video. Does anyone know what might be the problem? I'm working with different aspect ratios and frame rates in my ti