PROCEDURE WITH CURSOR ERROR

I wanted to have a cursor in my procedure having results from different tables and different databases. I successfully created the query and compiled it using the procedure builder. However, when i was about to create it as stored procedure in iSQLplus, it displayed a warning. It says "Procedure created wuth compilation error." The first error is "PLS-00341: declaration of cursor 'SUBJ_CUR' is incomplete or malformed"
Here's a piece of my code:
PROCEDURE assess(STUD_ID VARCHAR2, STUD_YEAR NUMBER, STUD_TYPE CHAR) IS
CURSOR subj_cur IS
SELECT e.student_id, s.subject_id, s.subj_code, s.subject_title, s.units, s.pay_units,
d.department_name, s.tuition_fee_type, s.lab_fee_type, f.year, f.amount
FROM regist.enrol e, regist.offering o, regist.subject s,
fee_details f, regist.student st, regist.department d
WHERE (e.student_id = STUD_ID) AND (e.offering_id = o.offering_id) AND
(o.subject_id = s.subject_id) AND (f.fee_no = s.tuition_fee_type) AND
(st.student_id=e.student_id) AND ((f.year = STUD_YEAR) OR (f.year=0)) AND
(s.department_id = d.department_id);
regist and system are databases.
Can anyone tell me where did I go wrong?
I resorted though in creating views, however I still received an error. It says, "Insufficient privileges"
Help me please..... I really need it badly..

First of all, I've no experience with iSQLplus. I'm just wondering in which database the table fee_details is: system or regist? You didn't prefix the table.

Similar Messages

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

  • Compiles a procedure with syntax error

    In the script tab, try to compile a procedure with syntax errors.
    The message displays procedure compiled !!!
    It should display that procedure compiled with errors.

    Hi Kris,
    I searched through the threads, but did not come across a similar question and that is why i raised the query. It'll be helpful if you could answer the query.
    regards,

  • Stored procedure with cursor as output param

    It's the first time for me to test a stored procedure with a cursor as output parameter. I executed the following:
    SQL> VARIABLE user_cur REFCURSOR; VARIABLE ret_code VARCHAR2; exec TEST_API.SEARCH_USER( :ret_code, '', '', 'john', '', :user_cur); print ret_code;print user_cur;
    I got the following error:
    Usage: VAR[IABLE] [ <variable> [ NUMBER | CHAR | CHAR (n [CHAR|BYTE]) |
    VARCHAR2 (n CHAR) | NCHAR | NCHAR (n) |
    NVARCHAR2 (n) | CLOB | NCLOB | REFCURSOR ] ]
    May I know what's the problem?
    The purpose of the stored procedure is to search for user with the name "john".
    The stored procudure input/output params declaration is as follows:
    PROCEDURE SEARCH_USER
    RETURN_CODE OUT VARCHAR2,
    USER_ID_IN IN VARCHAR2,
    POSITION_IN IN VARCHAR2,
    USERNAME_IN IN VARCHAR2,
    STATUS_IN IN VARCHAR2,
    USER_CUR_OUT OUT REFCURSOR
    Edited by: user7383310 on Oct 19, 2008 9:05 PM
    Edited by: user7383310 on Oct 19, 2008 9:05 PM

    for the usage of refcursors in pl/sql refer here..
    http://download.oracle.com/docs/cd/B14117_01/appdev.101/b10807/06_ora.htm#sthref808
    You can code like..
    SQL> create or replace procedure p1(id number,csr out sys_refcursor) is
      2  begin
      3   open csr for select ename from emp where deptno = id;
      4  end;
      5  /
    Procedure created.
    SQL> var csr1 refcursor
    SQL> var n number
    SQL> exec :n := 30;
    PL/SQL procedure successfully completed.
    SQL> exec p1(:n,:csr1);
    PL/SQL procedure successfully completed.
    SQL> print csr1
    ENAME
    ALLEN
    WARD
    MARTIN
    BLAKE
    TURNER
    JAMES
    6 rows selected.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • 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

  • 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

  • Error in procedure with cursor which has a select query in NVL

    cursor has a select statement in the NVL functiion
    sample query in given
    SELECT fu.user_name Core_ID,
    fu.description User_Name,
    fu.LAST_LOGON_DATE LAST_LOGON_DATE,
    TRUNC(SYSDATE) - TRUNC(fu.LAST_LOGON_DATE) DAYS_SINCE_LAST_LOGON,
    NVL((SELECT 'YES' FROM custmot.moto_rma_approvers mra
    WHERE mra.primary_approver = fu.user_name),'NO') PRIMARY_RMA_APPROVER,
    NVL((SELECT 'YES' FROM custmot.moto_rma_approvers mra
    WHERE mra.secondary_approver = fu.user_name), 'YES', 'ALL RESPONSIBILITIES',
    DECODE(fu.employee_id, NULL, 'USER ACCOUNT', 'ALL RESPONSIBILITIES' ))) END_DATE_WHAT
    FROM apps.fnd_user fu
    This query runs fine when it is run seperately. But when its defined in cursor in a procedure it throws up the following error.
    "Encountered the symbol "SELECT" when expecting one of the following:
    ( - + mod not null others <an identifier>
    <a double-quoted delimited-identifier> <a bind variable> avg
    count c"
    can you please help us with this

    I noticed your statement has one additional end-bracket at the end. Probably this is just a typo. It should read like this:
    SELECT fu.user_name core_id,
           fu.description user_name,
           fu.last_logon_date last_logon_date,
           TRUNC (SYSDATE) - TRUNC (fu.last_logon_date) days_since_last_logon,
           NVL ((SELECT 'YES'
                   FROM custmot.moto_rma_approvers mra
                  WHERE mra.primary_approver = fu.user_name), 'NO')
                                                             primary_rma_approver,
           NVL ((SELECT 'YES'
                   FROM custmot.moto_rma_approvers mra
                  WHERE mra.secondary_approver = fu.user_name),
                'YES',
                'ALL RESPONSIBILITIES',
                DECODE (fu.employee_id,
                        NULL, 'USER ACCOUNT',
                        'ALL RESPONSIBILITIES'
               ) end_date_what
      FROM apps.fnd_user fuIf that doesn't help, you may make your cursor dynamic:
       OPEN c FOR 'SELECT fu.user_name core_id,
           fu.description user_name,
           fu.last_logon_date last_logon_date,
           TRUNC (SYSDATE) - TRUNC (fu.last_logon_date) days_since_last_logon,
           NVL ((SELECT ''YES''
                   FROM custmot.moto_rma_approvers mra
                  WHERE mra.primary_approver = fu.user_name), ''NO'')
                                                             primary_rma_approver,
           NVL ((SELECT ''YES''
                   FROM custmot.moto_rma_approvers mra
                  WHERE mra.secondary_approver = fu.user_name),
                ''YES'',
                ''ALL RESPONSIBILITIES'',
                DECODE (fu.employee_id,
                        NULL, ''USER ACCOUNT'',
                        ''ALL RESPONSIBILITIES''
               ) end_date_what
      FROM apps.fnd_user fu';

  • Toplink storedProcedure/funtion + PL/SQL Procedure with cursor

    Hi,
    I am working on Toplink storedProcedure but, I am not getting any output. I go through the Oracle Tutorial but, still I am not getting any alternative.
    please, anyone help out....
    Thanking You,
    regards,
    sufian

    Hello Sufian,
    You seem to have a few threads trying to get a Stored proc working. In How to work with Toplink + PL/SQL Procedure + Cursor
    you mention you get an error when executing, have you gotten past this exception? You may want to turn on TopLink logging to see the statement TopLink is creating and sending to the driver. Please see
    http://www.oracle.com/technology/products/ias/toplink/doc/1013/main/_html/sescfg004.htm
    If you are not familar with how to turn on logging.
    Also, are you able to get results from a stored procedure that returns data instead of a cursor?
    Best Regards,
    Chris

  • Help need for procedure with "cursor in a cursor"

    Hi
    Iam using two cursors in my procedure.
    Create SP_sample as
    cursor C1 is
    select a from A
    cursor C2 is
    select
    a,bc,d from A,B where A.a=B.a
    Begin
    For Cur_rec C1 loop
    For Cur_rec1 C2 loop
    "SELECT QUERY"
    end loop
    end loop
    end
    1)the "SELECT QUERY" is working fine in Toad or sql editor.
    2)The procedure is compiled without any errors
    But when I am executing the procedure I am getting the error
    ORA-01403: no data found
    ORA-06512: at the line where "SELECT QUERY" is starting
    ORA-06512: at line 1
    can you please suggest what are the things I should be checking.
    Thanks

    Could you provide a more complete example of what you are doing.
    Your example is vague on the details, and it appears that you have 2 cursors both selecting from table A that you are looping through in a nested fashion, but your inner cursor is not correlated with your outer cursor. Also you have skimped on the details of the select you are trying to perform in the inner most loop of your code, and there is no indication that it has any correlation to the two outer cursors, and to top it off you have completely left out any syntactic punctuation.
    why not rewrite your code thusly:
    declare
      cursor c1 is select a from a;
      cursor c2(p_a a.a%type) is select bc, d from b where b.a = p_a;
    begin
      for cur_rec in c1 loop
        for cur_rec1 in c2(cur_rec.a) loop
          select ...
          into ...
          from ....
          where ??= cur_rec.a
          and ??=cur_rec1.bc
          and ??=cur_rec1.d;
        end loop;
      end loop;
    end;

  • Procedure with Cursor

    I have the following code:
    CREATE OR REPLACE PROCEDURE RENTALPAYMENTS( p_PROPERTY_DETAIL_ID LMR_PROPERTY_DETAILS.LMR_PROPERTY_DETAIL_ID%TYPE )
    IS
    CURSOR property_detail_cur IS SELECT RENT, BOND, START_DATE, LEASE_PERIOD, PAYMENT_INTERVAL, PROP_PROPERTY_ID, TEN_TENANT_ID
    FROM LMR_PROPERTY_DETAILS WHERE LMR_PROPERTY_DETAIL_ID = p_PROPERTY_DETAIL_ID;
    v_rent LMR_PROPERTY_DETAILS.RENT%TYPE;
    v_bond LMR_PROPERTY_DETAILS.BOND%TYPE;
    v_startdate LMR_PROPERTY_DETAILS.START_DATE%TYPE;
    v_lease_period LMR_PROPERTY_DETAILS.LEASE_PERIOD%TYPE;
    v_payment_interval LMR_PROPERTY_DETAILS.PAYMENT_INTERVAL%TYPE;
    v_property_id LMR_PROPERTY_DETAILS.PROP_PROPERTY_ID%TYPE;
    v_tenant_id LMR_PROPERTY_DETAILS.TEN_TENANT_ID%TYPE;
    BEGIN
    OPEN property_detail_cur;
    LOOP
    FETCH property_detail_cur INTO v_rent, v_bond, v_startdate, v_lease_period, v_payment_interval, v_property_id, v_tenant_id;
    DBMS_OUTPUT.PUT_LINE('RENT: '||v_rent);
    DBMS_OUTPUT.PUT_LINE('BOND: '||v_bond);
    DBMS_OUTPUT.PUT_LINE('START DATE: '||v_startdate);
    DBMS_OUTPUT.PUT_LINE('LEASE PERIOD: '||v_lease_period);
    DBMS_OUTPUT.PUT_LINE('PAYMENT INTERVAL: '||v_payment_interval);
    DBMS_OUTPUT.PUT_LINE('PROPERTY ID: '||v_property_id);
    DBMS_OUTPUT.PUT_LINE('TENANT ID: '||v_tenant_id);
    EXIT WHEN property_detail_cur%NOTFOUND;
    END;
    It should be obvious looking at the code what I am attempting to do.
    I get the following error when running on the SQL Commandline in Oracle APEX:
    Error at line 35: PLS-00103: Encountered the symbol ";" when expecting one of the following:
    loop
    It highlights line 3.

    It should be obvious looking at the code what I am attempting to do.There could be a difference with what your code does, and what you are attempting to do... 'cause what your code does is not compile, and that is probably not what your attempting to do... ;)
    Anyway, you are missing the END LOOP;
    The way you go through the cursor is row-by-row (a.k.a slow-by-slow), and you don't need al those local variables:
    CREATE OR REPLACE PROCEDURE RENTALPAYMENTS( p_PROPERTY_DETAIL_ID LMR_PROPERTY_DETAILS.LMR_PROPERTY_DETAIL_ID%TYPE )
    IS
    begin
       for rec in (
          SELECT RENT, BOND, START_DATE, LEASE_PERIOD, PAYMENT_INTERVAL, PROP_PROPERTY_ID, TEN_TENANT_ID
          FROM LMR_PROPERTY_DETAILS
          WHERE LMR_PROPERTY_DETAIL_ID = p_PROPERTY_DETAIL_ID
       loop
          DBMS_OUTPUT.PUT_LINE('RENT: '||rec.rent);
          DBMS_OUTPUT.PUT_LINE('BOND: '||rec.bond);
          DBMS_OUTPUT.PUT_LINE('START DATE: '||rec.startdate);
          DBMS_OUTPUT.PUT_LINE('LEASE PERIOD: '||rec.lease_period);
          DBMS_OUTPUT.PUT_LINE('PAYMENT INTERVAL: '||rec.payment_interval);
          DBMS_OUTPUT.PUT_LINE('PROPERTY ID: '||rec.property_id);
          DBMS_OUTPUT.PUT_LINE('TENANT ID: '||rec.tenant_id);
       end loop;
    END;
    /.. not tested of course...

  • Test Result set procedure with cursor

    i am really new for oracle and i don't know how to test my result set procedure in oracle.
    i am now working on Oracle 10g Express Edition.
    my procedure is below.
    create or replace procedure "GETORDERSBYCATALOGUECODE"
    (p_cataloguecode IN VARCHAR2, p_cursor IN OUT SYS_REFCURSOR )
    is
    begin
    open p_cursor for SELECT OrderID, NumberOrdered, CostCharged
    FROM OrderDetails
    WHERE CatalogueCode=p_cataloguecode;
    end;
    i am not sure how can i work with the the cursor and the procedure to display cursor data in Oracle 10g Express Web Admin?
    Tunk

    Hi, test the following statement in command line:
    SQL>VAR ordercursor REFCURSOR;
    SQL>EXECUTE GETORDERsBYCATALOGUECODE('001',:ordercursor);
    SQL>print :ordercursor;
    I+n your code, the error is OPEN ORDERCURSOR, the ORDERCURSOR cursor is open by default.+
    Your correct code  is:
    declare
    ordercursor SYS_REFCURSOR;
    orderid NUMBER;
    numberordered NUMBER;
    costcharged BINARY_DOUBLE;
    begin
    GETORDERsBYCATALOGUECODE('001',ordercursor);
    DBMS_OUTPUT.ENABLE(20000);
    DBMS_OUTPUT.PUT_LINE('Order Number, Number Ordered, Cost Charged');
    LOOP
    FETCH ordercursor INTO orderid, numberordered, costcharged;
    exit when ordercursor%notfound;
    DBMS_OUTPUT.PUT_LINE(orderid || ', ' || numberordered || ', ' || costcharged);
    END LOOP;
    CLOSE ordercursor;
    end;
    Roberto.
    Edited by: user584812 on Dec 23, 2008 3:47 PM

  • Excution of a PL/SQL procedure with CURSOR for big tables

    I have prepared a proceudre that uses CURSOR to make a complex query for tables with big number of records, something like 900'000. And the execution failed; ORA-01652:impossible to extend the temporary segment of 64 in the space of storage TEMP.
    Any sugestion.

    This brings us to the following question: How could I calculate the bytes required by a cursor?. It is a selection of certain fields of very big tables. Let's say that the fields are NUMBER(4), NUMBER(8) and CHAR(2). The fields are in 2 relational tables of 900'000 each. What size is required for a procedure like this.
    Your help is really appreciated.

  • Select clause inside a Procedure with cursor

    Good Moring guys,
    I run into a problem that is giving me serious troubles.... I have a Select clause:
                  SELECT count(*)
                 FROM TD004_ENT_ORGAO_UO TD004
                 WHERE TD004.CODG_ENTIDADE = 1121742
                 AND TD004.NUMR_ANO_EXERCICIO = 2011
                 AND TD004.CODG_ORGAO = 02
                 AND TD004.CODG_UO = 001
    My table is empty and this query returns a count = 0, so far so good but, when I'm using this same query inside a Procedure that implements a cursor, I'm implementing a way of controling when to or not insert the records of this cursor in my table:
    OPEN cDIMENSAO;
    LOOP
           FETCH cDIMENSAO INTO EXERCICIO, CODG_ORGAO, NOME_ORGAO, CODG_UO, NOME_UO, CODG_ENTIDADE, SK_ENTIDADE;
           EXIT WHEN cDIMENSAO%NOTFOUND;
           begin
                 v_count := 0;
                 SELECT count(*) into V_COUNT
                 FROM TD004_ENT_ORGAO_UO TD004
                 WHERE TD004.CODG_ENTIDADE = CODG_ENTIDADE
                 AND TD004.NUMR_ANO_EXERCICIO = EXERCICIO
                 AND TD004.CODG_ORGAO = CODG_ORGAO
                 AND TD004.CODG_UO = CODG_UO;
                 IF V_COUNT = 0 THEN
                    INSERT INTO APLIC.TD004_ENT_ORGAO_UO(SK_ENT_ORGAO_UO, NUMR_ANO_EXERCICIO, CODG_ORGAO, NOME_ORGAO, CODG_UO, NOME_UO, CODG_ENTIDADE, SK_ENTIDADE, DATA_CARGA)
                    VALUES (APLIC.SK004_ENT_ORGAO_UO.NEXTVAL, EXERCICIO, CODG_ORGAO, NOME_ORGAO, CODG_UO, NOME_UO,CODG_ENTIDADE,SK_ENTIDADE,v_data_carga);
                    COMMIT;
                 END IF;
    The problem occurs here, my v_count controler just returns 1 even if the record isnt inside my table, is like the Where clasue is being ignored. What can be done ??
    I'm using the Oracle XE 11g.
    Thnks all.

    See below. Where clause will never ignore any condition
    Note: you need handle null values  specially
    SQL>
    SQL> select * from v$version;
    BANNER                                                                         
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production   
    PL/SQL Release 11.2.0.2.0 - Production                                         
    CORE 11.2.0.2.0 Production                                                     
    TNS for Linux: Version 11.2.0.2.0 - Production                                 
    NLSRTL Version 11.2.0.2.0 - Production                                         
    SQL>
    SQL> set serveroutput on;
    SQL>
    SQL> DECLARE
      2     CURSOR c1
      3     IS
      4        WITH dmn
      5             AS (SELECT 1 col1, 'TEST' col2, NULL col3 FROM DUAL
      6             UNION ALL
      7                 SELECT 2 col1, 'TESTING' col2, 'COL3' col3 FROM DUAL
      8              UNION ALL
      9                 SELECT 3 col1, 'TESTING123' col2, 'COL3' col3 FROM DUAL
    10                )
    11        SELECT *
    12          FROM dmn;
    13 
    14     v_col1    VARCHAR2 (10);
    15     v_col2    VARCHAR2 (10);
    16     v_col3    VARCHAR2 (10);
    17     v_count   NUMBER;
    18  BEGIN
    19     OPEN c1;
    20 
    21     LOOP
    22        FETCH c1
    23        INTO v_col1, v_col2, v_col3;
    24        EXIT WHEN c1%NOTFOUND;
    25 
    26           WITH txn
    27             AS (SELECT 1 col1, 'TEST' col2, NULL col3 FROM DUAL
    28                 UNION ALL
    29                 SELECT 2 col1, 'TESTING' col2, 'COL3' col3 FROM DUAL
    30                )
    31        SELECT COUNT (*)
    32          INTO v_count
    33          FROM txn
    34         WHERE  col1 = v_col1
    35               AND col2 = v_col2
    36               AND nvl(col3,'##') = nvl(v_col3, '##');
    37 
    38           DBMS_OUTPUT.put_line ('V_count = ' || v_count);
    39        IF v_count = 0
    40        THEN
    41           DBMS_OUTPUT.put_line ('Insert is processed for ' || v_col1);
    42        ELSE
    43           DBMS_OUTPUT.put_line ('Insert is Ignored for ' || v_col1);
    44        END IF;
    45        v_count := 0;
    46     END LOOP;
    47  END;
    48  /
    V_count = 1                                                                    
    Insert is Ignored for 1                                                        
    V_count = 1                                                                    
    Insert is Ignored for 2                                                        
    V_count = 0                                                                    
    Insert is processed for 3                                                      
    PL/SQL procedure successfully completed.
    Thanks,
    GPU

  • JCA Error while calling Stored Procedure containing cursors in BPEL/OSB

    Hi,
    I created JCA DBAdapter in Jdeveloper for calling remote stored procedure which contains cursors as OUT parameters.
    I'm getting below exception when i try to call the database via BPEL/OSB.the same remote procedure call is working on Invoking with WLI .
    Kindly sugggest !!!
    The invocation resulted in an error: I*nvoke JCA outbound service failed with connection error, exception: com.bea.wli.sb.transports.jca.JCATransportException: oracle.tip.adapter.sa.api.JCABindingException: oracle.tip.adapter.sa.impl.fw.ext.org.collaxa.thirdparty.apache.wsif.WSIFException: servicebus:/WSDL/ServiceBus/BusinessServices/IsdnSiebelConn [ IsdnSiebelConn_ptt::IsdnSiebelConn(InputParameters,OutputParameters) ] - WSIF JCA Execute of operation 'IsdnSiebelConn' failed due to: Get object error.*
    Error retrieving the value of a parameter R_NON_CNF_ATTR_CURSOR.
    An error occurred when retrieving the value of parameter R_NON_CNF_ATTR_CURSOR after invoking the SIEBEL.ISDN_OBT_INS_DET.OBTAINASSETDETAILS API. Cause: java.sql.SQLException: Cursor is closed.
    *; nested exception is:*
    BINDING.JCA-11810
    Get object error.
    Error retrieving the value of a parameter R_NON_CNF_ATTR_CURSOR.
    An error occurred when retrieving the value of parameter R_NON_CNF_ATTR_CURSOR after invoking the SIEBEL.ISDN_OBT_INS_DET.OBTAINASSETDETAILS API. Cause: java.sql.SQLException: Cursor is closed.
    Check to ensure that the parameter has been correctly registered as a valid IN/OUT or OUT parameter of the API. This exception is considered retriable, likely due to a communication failure. To classify it as non-retriable instead add property nonRetriableErrorCodes with value "0" to your deployment descriptor (i.e. weblogic-ra.xml). To auto retry a retriable fault set these composite.xml properties for this invoke: jca.retry.interval, jca.retry.count, and jca.retry.backoff. All properties are integers.
    com.bea.wli.sb.transports.jca.JCATransportException: oracle.tip.adapter.sa.api.JCABindingException: oracle.tip.adapter.sa.impl.fw.ext.org.collaxa.thirdparty.apache.wsif.WSIFException: servicebus:/WSDL/ServiceBus/BusinessServices/IsdnSiebelConn [ IsdnSiebelConn_ptt::IsdnSiebelConn(InputParameters,OutputParameters) ] - WSIF JCA Execute of operation 'IsdnSiebelConn' failed due to: Get object error.
    Error retrieving the value of a parameter R_NON_CNF_ATTR_CURSOR.
    An error occurred when retrieving the value of parameter R_NON_CNF_ATTR_CURSOR after invoking the SIEBEL.ISDN_OBT_INS_DET.OBTAINASSETDETAILS API. Cause: java.sql.SQLException: Cursor is closed.
    ; nested exception is:
    BINDING.JCA-11810
    Get object error.
    Error retrieving the value of a parameter R_NON_CNF_ATTR_CURSOR.
    An error occurred when retrieving the value of parameter R_NON_CNF_ATTR_CURSOR after invoking the SIEBEL.ISDN_OBT_INS_DET.OBTAINASSETDETAILS API. Cause: java.sql.SQLException: Cursor is closed.
    Check to ensure that the parameter has been correctly registered as a valid IN/OUT or OUT parameter of the API. This exception is considered retriable, likely due to a communication failure. To classify it as non-retriable instead add property nonRetriableErrorCodes with value "0" to your deployment descriptor (i.e. weblogic-ra.xml). To auto retry a retriable fault set these composite.xml properties for this invoke: jca.retry.interval, jca.retry.count, and jca.retry.backoff. All properties are integers.
    at com.bea.wli.sb.transports.jca.binding.JCATransportOutboundOperationBindingServiceImpl.invoke(JCATransportOutboundOperationBindingServiceImpl.java:153)
    at com.bea.wli.sb.transports.jca.JCATransportEndpoint.sendRequestResponse(JCATransportEndpoint.java:209)
    at com.bea.wli.sb.transports.jca.JCATransportEndpoint.send(JCATransportEndpoint.java:170)
    at com.bea.wli.sb.transports.jca.JCATransportProvider.sendMessageAsync(JCATransportProvider.java:571)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.bea.wli.sb.transports.Util$1.invoke(Util.java:83)
    at $Proxy127.sendMessageAsync(Unknown Source)
    at com.bea.wli.sb.transports.LoadBalanceFailoverListener.sendMessageAsync(LoadBalanceFailoverListener.java:148)
    at com.bea.wli.sb.transports.LoadBalanceFailoverListener.sendMessageToServiceAsync(LoadBalanceFailoverListener.java:603)
    at com.bea.wli.sb.transports.LoadBalanceFailoverListener.sendMessageToService(LoadBalanceFailoverListener.java:538)
    at com.bea.wli.sb.transports.TransportManagerImpl.sendMessageToService(TransportManagerImpl.java:558)
    at com.bea.wli.sb.transports.TransportManagerImpl.sendMessageAsync(TransportManagerImpl.java:426)
    at com.bea.wli.sb.test.service.ServiceMessageSender.send0(ServiceMessageSender.java:377)
    at com.bea.wli.sb.test.service.ServiceMessageSender.access$000(ServiceMessageSender.java:76)
    at com.bea.wli.sb.test.service.ServiceMessageSender$1.run(ServiceMessageSender.java:134)
    at com.bea.wli.sb.test.service.ServiceMessageSender$1.run(ServiceMessageSender.java:132)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147)
    at com.bea.wli.sb.security.WLSSecurityContextService.runAs(WLSSecurityContextService.java:55)
    at com.bea.wli.sb.test.service.ServiceMessageSender.send(ServiceMessageSender.java:137)
    at com.bea.wli.sb.test.service.ServiceProcessor.invoke(ServiceProcessor.java:454)
    at com.bea.wli.sb.test.TestServiceImpl.invoke(TestServiceImpl.java:172)
    at com.bea.wli.sb.test.client.ejb.TestServiceEJBBean.invoke(TestServiceEJBBean.java:167)
    at com.bea.wli.sb.test.client.ejb.TestService_sqr59p_EOImpl.invoke(TestService_sqr59p_EOImpl.java:353)
    at com.bea.wli.sb.test.client.ejb.TestService_sqr59p_EOImpl_WLSkel.invoke(Unknown Source)
    at weblogic.rmi.internal.ServerRequest.sendReceive(ServerRequest.java:174)
    at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:345)
    at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:259)
    at com.bea.wli.sb.test.client.ejb.TestService_sqr59p_EOImpl_1033_WLStub.invoke(Unknown Source)
    at com.bea.alsb.console.test.TestServiceClient.invoke(TestServiceClient.java:174)
    at com.bea.alsb.console.test.actions.DefaultRequestAction.invoke(DefaultRequestAction.java:117)
    at com.bea.alsb.console.test.actions.DefaultRequestAction.execute(DefaultRequestAction.java:70)
    at com.bea.alsb.console.test.actions.ServiceRequestAction.execute(ServiceRequestAction.java:143)
    at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
    at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.access$201(PageFlowRequestProcessor.java:97)
    at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor$ActionRunner.execute(PageFlowRequestProcessor.java:2044)
    at org.apache.beehive.netui.pageflow.interceptor.action.internal.ActionInterceptors.wrapAction(ActionInterceptors.java:91)
    at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.processActionPerform(PageFlowRequestProcessor.java:2116)
    at com.bea.alsb.console.common.base.SBConsoleRequestProcessor.processActionPerform(SBConsoleRequestProcessor.java:91)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
    at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.processInternal(PageFlowRequestProcessor.java:556)
    at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.process(PageFlowRequestProcessor.java:853)
    at com.bea.alsb.console.common.base.SBConsoleRequestProcessor.process(SBConsoleRequestProcessor.java:191)
    at org.apache.beehive.netui.pageflow.AutoRegisterActionServlet.process(AutoRegisterActionServlet.java:631)
    at org.apache.beehive.netui.pageflow.PageFlowActionServlet.process(PageFlowActionServlet.java:158)
    at com.bea.console.internal.ConsoleActionServlet.process(ConsoleActionServlet.java:256)
    at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
    at com.bea.console.internal.ConsoleActionServlet.doGet(ConsoleActionServlet.java:133)
    at com.bea.alsb.console.common.base.SBConsoleActionServlet.doGet(SBConsoleActionServlet.java:49)
    at org.apache.beehive.netui.pageflow.PageFlowUtils.strutsLookup(PageFlowUtils.java:1199)
    at org.apache.beehive.netui.pageflow.PageFlowUtils.strutsLookup(PageFlowUtils.java:1129)
    at com.bea.portlet.adapter.scopedcontent.ScopedContentCommonSupport.executeAction(ScopedContentCommonSupport.java:687)
    at com.bea.portlet.adapter.scopedcontent.ScopedContentCommonSupport.processActionInternal(ScopedContentCommonSupport.java:142)
    at com.bea.portlet.adapter.scopedcontent.StrutsStubImpl.processAction(StrutsStubImpl.java:76)
    at com.bea.portlet.adapter.NetuiActionHandler.raiseScopedAction(NetuiActionHandler.java:111)
    at com.bea.netuix.servlets.controls.content.NetuiContent.raiseScopedAction(NetuiContent.java:181)
    at com.bea.netuix.servlets.controls.content.NetuiContent.raiseScopedAction(NetuiContent.java:167)
    at com.bea.netuix.servlets.controls.content.NetuiContent.handlePostbackData(NetuiContent.java:225)
    at com.bea.netuix.nf.ControlLifecycle$2.visit(ControlLifecycle.java:180)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:324)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walkRecursive(ControlTreeWalker.java:334)
    at com.bea.netuix.nf.ControlTreeWalker.walk(ControlTreeWalker.java:130)
    at com.bea.netuix.nf.Lifecycle.processLifecycles(Lifecycle.java:395)
    at com.bea.netuix.nf.Lifecycle.processLifecycles(Lifecycle.java:361)
    at com.bea.netuix.nf.Lifecycle.processLifecycles(Lifecycle.java:352)
    at com.bea.netuix.nf.Lifecycle.runInbound(Lifecycle.java:184)
    at com.bea.netuix.nf.Lifecycle.run(Lifecycle.java:159)
    at com.bea.netuix.servlets.manager.UIServlet.runLifecycle(UIServlet.java:388)
    at com.bea.netuix.servlets.manager.UIServlet.doPost(UIServlet.java:258)
    at com.bea.netuix.servlets.manager.UIServlet.service(UIServlet.java:199)
    at com.bea.netuix.servlets.manager.SingleFileServlet.service(SingleFileServlet.java:251)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at weblogic.servlet.AsyncInitServlet.service(AsyncInitServlet.java:130)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.dms.wls.DMSServletFilter.doFilter(DMSServletFilter.java:330)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.doIt(WebAppServletContext.java:3684)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3650)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2268)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2174)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1446)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)

    You need to open all the cursors in the PLSQL ie., cursors should be initialized in your PLSQL package. JCA DB Adapter tries to open the cursor without checking whether its there or not..If you cant change the PLSQL package, raise a SR with Oracle for a patch.This would be considered as Enhancement Request.
    Regards
    Sesha

  • Getting error while Calling Oracle Stored Procedure with output Parameter

    HI All,
    From long days i am working on this but i unable to solve it.
    Even i have studied so many forums in SAP but i didn't find the solution.
    I am calling Oracle Store procedure with 3 inputs and 1 output without cursor.
    Store Procedure:-
    CREATE OR REPLACE PROCEDURE PDS.send_rm
    IS
    proc_name           VARCHAR2(64) := 'send_rm';
    destination_system  VARCHAR2(32) := 'RAWMAT';
    xml_message         VARCHAR2(4000);
    status_code         INTEGER;
    status_message      VARCHAR2(128);
    debug_message       VARCHAR2(128);
    p_ret               INTEGER;
    BEGIN
      DBMS_OUTPUT.PUT_LINE( proc_name || ' started' );
      xml_message := '<RAW_MATERIAL>'||
                     '<BAR_CODE>10000764601</BAR_CODE>'||
                     '<MATERIAL>1101448</MATERIAL>'||
                     '<VENDOR_CODE/>'||
                     '<PRODUCTION_DATE>0000-00-00</PRODUCTION_DATE>'||
                     '<EXPIRE_DATE>0000-00-00</EXPIRE_DATE>'||
                     '<BATCH/>'||
                     '<PO_NUM/>'||
                     '<MATERIAL_DESCRIPTION>POWER SUPPLY</MATERIAL_DESCRIPTION>'||
                     '<SPEC_NAME/>'||
                     '<STOCK_CODE>BSW-JH</STOCK_CODE>'||
                     '<INSPECTION_LOT>00</INSPECTION_LOT>'||
                     '<USAGE_DECISION_CODE/>'||
                     '<MATERIAL_GROUP>031</MATERIAL_GROUP>'||
                     '</RAW_MATERIAL>';
          dbms_output.put_line('XML '||xml_message);
    --      vp_interface.load_rawmat@cnprpt1_pds(SYSDATE, destination_system,
    --                   xml_message, p_ret);
          vp_interface.load_rawmat(SYSDATE, destination_system,
                       xml_message, p_ret);
          dbms_output.put_line('Return Code '||p_ret);
          COMMIT;
    EXCEPTION
      WHEN OTHERS THEN
        status_code := SQLCODE;
        status_message := SUBSTR(SQLERRM, 1, 64);
    --    Extract_Error_Logger(proc_name, 'LOCAL', SYSDATE, -999,
    --                         status_message, 0, debug_message);
        ROLLBACK;
    END send_rm;
    And while i am calling this Store procedure in MII, I am facing error.
    I have tried different ways but didnt solved
    In SQL Query, i kept mode as: FixedQueryOutput
    Can anyone tell me or send code for calling above store procedure
    And onemore thing, While creating store procedure in Oracle for MII. Do we need to Create output parameter as cursor or normal.  
    Thanks,
    Kind Regards,
    Praveen Reddy M

    Hi Praveen
    Our wrapper was created because we could not modify the procedure we call (it was not returning a cursor).
    CREATE OR REPLACE PROCEDURE CHECK_PUT_IN_USE
    (STRCMPNAME in varchar2,
    STRSCANLABEL in varchar2,
    RCT1 out SYS_REFCURSOR
    AS
      charDispo          Char(1);
      charStatus          Char(1);
      intCatNo          Integer;
      charCatDispo     Char(1);
      strCatQual          VarChar2(2);
      strCatDesc          VarChar2(30);
      strMsg          VarChar2(128);
    BEGIN
    qa.check_put_in_use@AR(STRCMPNAME,
                                              STRSCANLABEL,
                                              charDispo,
                                              charStatus,
                                              intCatNo,
                                              charCatDispo,
                                              strCatQual,
                                              strCatDesc,
                                              strMsg);
    OPEN RCT1
    FOR Select charDispo,charStatus,charDispo,charStatus,intCatNo,charCatDispo,strCatQual,strCatDesc,strMsg from Dual;
    END;
    Hope this helps
    Regards
    Amrik
    then with a FixedQueryWithOutput
    call mixar.qasap.wrapper_update_put_in_use('[Param.1]','[Param.2]',[Param.3],?)
    Hope this helps.

Maybe you are looking for

  • SQL Workshop - SQL Commands - Saved SQL:  Saved set of commands

    Has any thought been given to this, or perhaps this has already been done..... A saved set of SQL commands as a template For example, when I'm in Excel and I start writing a lookup formula, a guide appears below the cell, reminding me of the format o

  • Fullscreen Video Playback, from Button? Video Question

    I have used the external URL to link directly to a video and it opened in an HTML window, not just fullscreen. I would like to emulate what is seen in this example. LINK: http://youtu.be/-YMyQZki0bY?hd=1&t=1m2s

  • Desktop software connection password

    I have recently changed my laptop and have just downloaded the Blackberry software so that I can transfer some pictures and sync my Bold.  The problem is I don't remember the password from my initial setup.  I am now at 5 connections and the next one

  • C7 - Made in Country

    Hi, I'm from Sri Lanka, Since 8 Years I have used 02 Nokia Phones which is made in Hungary. But last few days I was looking to buy C7. But I checked several places including Authorized Dealer/Distributor in Sri Lanka, But I couldn't find any phone wh

  • Help with XPathAPI

    Hi all, I'm using XPathAPI to navigate an already DOM Parsed XML segment of a file and I have problems with the navigation through it.The segment looks like this: <tag>1222 <tag>5543 <tag>2445</tag><tag>9999</tag> </tag> </tag> I know that is not the