Returning the control out of the procedure

Gurus,
Please see my code
BEGIN
     BEGIN                                    -- To check whether the user(Record) exists in the table
            SELECT a.code, a.code_desc                                     
          INTO L_code, L_code_desc
            FROM CODE_DETAIL a, USER_ROLE_PRIVS b
            WHERE a.code_desc = b.granted_role
            AND a.code_type like '%CATR%'
            AND b.username = I_U_ID;
     EXCEPTION
          WHEN NO_DATA_FOUND THEN
          O_ERR_MSG := 'N';
     END;
  IF L_CODE <> '1' AND L_CODE <> '2' AND L_CODE <> '3' THEN     -- To check whether there is any other role associated other than 1, 2 or 3
     O_ERR_MSG := 'Y';
  END IF;This is a piece of code which is a part of procedure .. Now whenever I have O_ERR_MSG initialized to Y or N .. it should come out of the procedure... What's happenning now is, variable is getting initialized and executing the rest of the code, which shouldnt happen ..
Can you please tell me how to pass the control back to the procedure without executing the other lines ?
Regards

Ok... posting the entire code
CREATE OR REPLACE PROCEDURE AFE_CHECK_SUBMIT (I_u_id in varchar2, I_ord_num in number, O_rol out VARCHAR2, O_app_check OUT Varchar2, O_v_app_check out number, O_v_otb_check out number, O_AMT OUT NUMBER, O_ERR_MSG OUT VARCHAR2, O_error_message IN OUT varchar2 ) IS
L_role                  varchar2(30); 
L_approval_limit        number;         L_otb_limit             number;                
L_approval_level        varchar2(5);           
L_tolerance_limit       varchar2(40);            L_program VARCHAR2(60)  := 'AFE_CHECK_SUBMIT';
L_code                  VARCHAR2(10);
L_code_desc             VARCHAR2(30);
L_app_check             NUMBER;
L_otb_check             NUMBER;
L_amt                   NUMBER;
L_otb_amt1              NUMBER;
L_order_no           NUMBER;
L_status           VARCHAR2(1);
CURSOR C_PO_AMT IS SELECT i.dept, i.class, h.order_type, to_CHAR(h.otb_eow_date, 'MONYYYY') po_month, sum(o.qty_ordered * o.unit_cost) po_amt
FROM ITEM_MASTER i, ORDLOC o, ORDHEAD h
WHERE i.item = o.item
AND o.order_no = h.order_no
AND o.order_no = I_ord_num
GROUP BY i.dept, i.class, h.order_type, to_CHAR(h.otb_eow_date, 'MONYYYY');
CURSOR C_OTB_CALCULATE(order_type VARCHAR2, order_eow_date date, dep number, clas number ) IS
SELECT sum(decode(order_type, 'ARB', a_budget_amt-a_approved_amt,
                                         'BRB', b_budget_amt-b_approved_amt,
                                         'N/B', n_budget_amt-n_approved_amt,
                                             0)) otb_amt1
  FROM OTB
  WHERE to_char(EOW_DATE,'MONYYYY') = to_char(order_eow_date,'MONYYYY')
  AND DEPT = dep
  AND CLASS = clas
      GROUP BY to_CHAR(ORDER_EOW_DATE,'MONYYYY'),DEPT,CLASS;
      C2 C_OTB_CALCULATE%rowtype;
      c3 C_PO_AMT%rowtype;
CURSOR C_ROLE_CHECK IS
  SELECT a.code, a.code_desc                                      -- checking the role of the user who has logged in
  FROM CODE_DETAIL a, USER_ROLE_PRIVS b
  WHERE a.code_desc = b.granted_role
  AND a.code_type like '%CATR%'
  AND b.username = I_U_ID;
  L_ROLE_CHECK C_ROLE_CHECK%ROWTYPE;
BEGIN
   dbms_output.put_line('User id is :' || I_u_id);
   dbms_output.put_line('Selecting the role');
   BEGIN     
     OPEN C_ROLE_CHECK;
     LOOP
          FETCH C_ROLE_CHECK INTO L_ROLE_CHECK;
          EXIT WHEN C_ROLE_CHECK%NOTFOUND;
          L_code := L_ROLE_CHECK.code;
     END LOOP;
   EXCEPTION
          WHEN NO_DATA_FOUND THEN
             dbms_output.put_line('No Record in table');
          O_ERR_MSG := 'N';  
END;
  dbms_output.put_line('Role is :' || L_code);
  IF L_CODE <> '1' OR L_CODE <> '2' OR L_CODE <> '3' THEN
     O_ERR_MSG := 'Y';
     dbms_output.put_line('Unidentified user');
  END IF;
  IF L_code = '1' THEN                                       -- If user id is planner
       O_rol := '1';
     dbms_output.put_line('User is PLANNER (ROLE 1)');
        SELECT r.ORD_APPR_AMT                                   -- will be checking the approval limit of that role
        INTO L_approval_limit          
        FROM  RTK_ROLE_PRIVS r, CODE_DETAIL c
        WHERE r.ROLE = c.CODE_DESC
        AND c.CODE = L_code;
     dbms_output.put_line('Approval limit is :' || L_approval_limit);
        OPEN C_PO_AMT;                                          -- OTB check based on dept,class
        LOOP
          FETCH C_PO_AMT into c3;
                EXIT when c_PO_AMT%notfound;
          dbms_output.put_line('Entered 1st loop');
                OPEN C_OTB_CALCULATE(c3.order_type, TO_DATE(c3.po_month,'MONYYYY'), c3.dept, c3.class);
                LOOP
               dbms_output.put_line('Entered 2nd loop');
                     FETCH C_OTB_CALCULATE into c2;
                        EXIT WHEN C_OTB_CALCULATE%notfound;
                        L_amt := c3.PO_AMT;
               dbms_output.put_line('PO AMT IS:' || L_amt);
               IF c3.PO_AMT > L_approval_limit THEN    -- Checking whether amount greater than approval lim
                    dbms_output.put_line('Approval limit exceeded');
                             L_app_check := 1;
                                O_app_check := 'T';
                                O_v_app_check := 1;
                    O_amt := L_amt;
                    dbms_output.put_line('Approval check is:' || L_app_check);
                    dbms_output.put_line('Approval check exceeded? :' || O_app_check);
                    dbms_output.put_line('Parameter for Approval check is:' || O_v_app_check);
                        ELSIF C3.PO_AMT <= L_approval_limit then
                    dbms_output.put_line('Approval limit not exceeded');
                    dbms_output.put_line('Approval check is:' || L_app_check);
                    dbms_output.put_line('Parameter for Approval check is:' || O_v_app_check);
                                L_app_check := 0;
                                O_v_app_check := 0;
                        END IF;
               IF c3.PO_AMT > c2.OTB_AMT1 THEN         -- Checking whether amount greater than OTB amount
                    dbms_output.put_line('OTB AMT is :' || c2.otb_amt1);
                    dbms_output.put_line('OTB limit Exceeded');
                             L_otb_check := 1;
                                O_app_check := 'T';
                                O_v_otb_check := 1;
                    O_amt := L_amt;
                    dbms_output.put_line('OTB check is:' || L_otb_check);
                    dbms_output.put_line('OTB check exceeded? :' || O_app_check);
                    dbms_output.put_line('Parameter for OTB check is:' || O_v_otb_check);
                        ELSIF C3.PO_AMT <= C2.OTB_AMT1 THEN
                    dbms_output.put_line('OTB limit not exceeded');
                                L_otb_check := 0;
                                O_v_otb_check := 0;
                    dbms_output.put_line('OTB check is:' || L_otb_check);
                    dbms_output.put_line('Parameter for OTB check is:' || O_v_otb_check);
                        END IF;
                END LOOP;
                CLOSE C_OTB_CALCULATE;
        END LOOP;
        CLOSE c_PO_AMT;
     IF L_app_check = 0 and L_otb_check = 0 then            
          SELECT ORDER_NO, STATUS                     -- Checking whether there is a duplicate order number
          INTO L_order_no, L_status                    
          FROM AFE_POAPPROVAL
          WHERE ORDER_NO = I_ord_num;
          IF L_status = 'O' then                         -- If found and its stauts is open, update the record by changing the status column to "C"
               UPDATE AFE_POAPPROVAL
               SET STATUS = 'C'
               WHERE ORDER_NO = I_ord_num;
               COMMIT;
          END IF;
          INSERT INTO AFE_POAPPROVAL                    -- Inserting the record into AFE_POAPPROVAL when OTB and approval limit is below the PO amt
                VALUES (I_ord_num, 1,'O',I_u_id,'ROLE1','N','N', SYSDATE,'S', L_amt);
          dbms_output.put_line('Inserted Record into AFE_POAPPROVAL');
                COMMIT;                
        END IF;
      ELSIF L_code = '2' THEN                            -- If user id is category manager
     dbms_output.put_line('User is Category manager (ROLE 2)');          
           O_rol := '2';
              SELECT r.ORD_APPR_AMT                                        -- will be checking the approval limit of that role
              INTO L_approval_limit          
              FROM  RTK_ROLE_PRIVS r, CODE_DETAIL c
              WHERE r.role = c.CODE_DESC
              AND c.CODE = L_code;
           dbms_output.put_line('Approval limit is :' || L_approval_limit);
              OPEN c_PO_AMT;                                          -- OTB check based on dept,class
              LOOP
                   FETCH c_PO_AMT into c3;
                EXIT when c_PO_AMT%notfound;
          dbms_output.put_line('Entered 1st loop');
                OPEN C_otb_CALCULATE(c3.order_type, TO_DATE(c3.po_month,'MONYYYY'), c3.dept, c3.class);
                LOOP
                     FETCH C_OTB_CALCULATE into c2;
                        EXIT WHEN C_OTB_CALCULATE%notfound;
               dbms_output.put_line('Entered 2nd loop');
                        L_amt := c3.PO_AMT;
               dbms_output.put_line('PO AMT is:' || L_amt);
                        IF c3.PO_AMT > L_approval_limit THEN    -- Checking whether amount greater than approval limit
                    dbms_output.put_line('Approval limit exceeded');
                             L_app_check := 1;
                                O_app_check := 'T';
                                O_v_app_check := 1;
                    O_amt := L_amt;
                    dbms_output.put_line('Approval check is:' || L_app_check);
                    dbms_output.put_line('Approval check exceeded? :' || O_app_check);
                    dbms_output.put_line('Parameter for Approval check is:' || O_v_app_check);
                        ELSE
                    dbms_output.put_line('Approval limit not exceeded');
                                L_app_check := 0;
                                O_v_app_check := 0;
                    dbms_output.put_line('Approval check is:' || L_app_check);
                    dbms_output.put_line('Parameter for Approval check is:' || O_v_app_check);
                        END IF;
                        L_otb_amt1 := c2.OTB_AMT1;
               dbms_output.put_line('Selecting tolerance limit');
                        SELECT cd.code_desc                                     -- will be chekcing the tolerance limit
                        INTO L_tolerance_limit
                        FROM CODE_DETAIL cd, CODE_HEAD ch
                        WHERE ch.CODE_TYPE = cd.code_type
                        AND ch.CODE_TYPE = 'OTBT';
                        L_tolerance_limit := to_number(L_tolerance_limit);
               dbms_output.put_line('Tolerance limit is:' || L_tolerance_limit);
                        L_otb_limit := c2.OTB_AMT1-(c2.OTB_AMT1 * (1- (L_tolerance_limit/100))); -- Will be calculating the tolerance limit
               dbms_output.put_line('OTB AMT is :' || L_otb_amt);
                        IF c3.PO_AMT > L_otb_limit THEN         -- Checking whether amount greater than OTB amount
                    dbms_output.put_line('OTB limit exceeded');
                             L_otb_check := 1;
                                O_app_check := 'T';
                                O_v_otb_check := 1;
                    O_amt := L_amt;
                    dbms_output.put_line('OTB check is:' || L_otb_check);
                    dbms_output.put_line('OTB check exceeded? :' || O_app_check);
                    dbms_output.put_line('Parameter for OTB check is:' || O_v_otb_check);
                        ELSE
                    dbms_out.put_line('OTB Limit not exceeded');
                                L_otb_check := 0;
                                O_v_otb_check := 0;
                    dbms_output.put_line('OTB check is:' || L_otb_check);
                    dbms_output.put_line('Parameter for OTB check is:' || O_v_otb_check);
                        END IF;
                END LOOP;
                CLOSE C_OTB_CALCULATE;
              END LOOP;
              CLOSE c_PO_AMT;
              IF L_app_check = 0 and L_otb_check = 0 THEN            
                SELECT ORDER_NO, STATUS                     -- Checking whether there is a duplicate order number
          INTO L_order_no, L_status
          FROM AFE_POAPPROVAL
          WHERE ORDER_NO = I_ord_num;
          IF L_status = 'O' then                         -- If found and its stauts is open, update the record by changing the status column to C
               UPDATE AFE_POAPPROVAL
               SET STATUS = 'C'
               WHERE ORDER_NO = I_ord_num;
               COMMIT;
          END IF;
                INSERT INTO AFE_POAPPROVAL                    -- Inserting the record into AFE_POAPPROVAL when OTB and approval limit is below the PO amt
                VALUES (I_ord_num, 1,'O',I_u_id,'ROLE2','N','N', SYSDATE, 'S', L_amt);                 
                COMMIT;
          dbms_output.put_line('Inserted Record into AFE_POAPPROVAL');
              END IF;
       ELSIF L_code = '3' THEN                                         -- If user id is category head
     dbms_output.put_line('User is Category Head (ROLE3)');
            O_rol := 3;
        OPEN c_PO_AMT;                                          -- OTB check based on dept,class
        LOOP
             FETCH c_PO_AMT into c3;
                EXIT when c_PO_AMT%notfound;
          dbms_output.put_line('Entered 1st loop');
                OPEN C_OTB_CALCULATE(c3.order_type, to_date(c3.po_month,'MONYYYY'), c3.dept, c3.class);
                LOOP
                     FETCH C_OTB_CALCULATE into c2;
                        EXIT WHEN C_OTB_CALCULATE%notfound;
               dbms_output.put_line('Entered 2nd loop');     
                        L_amt := c3.PO_AMT;
               dbms_output.put_line('PO AMT is :' || L_amt);     
                        IF c3.PO_AMT > c2.OTB_AMT1 THEN         -- Checking whether amount greater than OTB amount
                    dbms_output.put_line('OTB AMT is :' || c2.otb_amt1);
                    dbms_output.put_line('OTB Limit exceeded');
                             L_otb_check := 1;
                                O_app_check := 'T';
                                O_v_otb_check := 1;                                        
                    O_amt := L_amt;
                    dbms_output.put_line('OTB check is:' || L_otb_check);
                    dbms_output.put_line('OTB check exceeded? :' || O_otb_check);
                    dbms_output.put_line('Parameter for OTB check is:' || O_v_otb_check);
                        ELSE
                    dbms_output.put_line('OTB limit not exceeded');
                                L_otb_check := 0;
                                O_v_otb_check := 0;
                    dbms_output.put_line('OTB check is:' || L_otb_check);
                    dbms_output.put_line('Parameter for OTB check is:' || O_v_otb_check);
                        END IF;
                END LOOP;
                CLOSE C_OTB_CALCULATE;
        END LOOP;
        CLOSE c_PO_AMT;
        IF L_otb_check = 0 THEN                                
IF L_otb_check = 0 THEN                                
          OPEN C_RECORD_CHECK;
          LOOP
               FETCH C_RECORD_CHECK INTO L_RECORD_CHECK;
               EXIT WHEN C_RECORD_CHECK%notfound;
               IF C_RECORD_CHECK%FOUND THEN
                    UPDATE AFE_POAPPROVAL
                    SET STATUS = 'C'
                    WHERE ORDER_NO = I_ord_num;
                    COMMIT;
               END IF;
          END LOOP;
          INSERT INTO AFE_POAPPROVAL                    -- Inserting the record into AFE_POAPPROVAL when otb and approval limit is below the po amount
                 VALUES (I_ord_num, 1,'O',I_u_id,'ROLE3','Y','N', SYSDATE,'S', L_amt);
                 COMMIT;
          dbms_output.put_line('Inserted Record into AFE_POAPPROVAL');
        END IF;
     END IF;
  EXCEPTION
     WHEN OTHERS THEN
        O_error_message := SQL_LIB.CREATE_MSG('PACKAGE_ERROR',
                                               SQLERRM,
                                               L_program,
                                               TO_CHAR(SQLCODE));
  END AFE_CHECK_SUBMIT;
/Now i am executing the procedure ...
SQL>SQL> @OUT_SUBMIT;
Enter value for user: RMS12DEV
old 12: o_user :='&user';
new 12: o_user :='RMS12DEV';
Enter value for order: 6139
old 13: o_order :=&order;
new 13: o_order :=6139;
User id is :RMS12DEV
Selecting the role
No Record in table
Role is :
o_rol:
O_app_check:
O_v_app_check:
O_v_otb_check:
O_amt:
O_ERR_MSG: N
O_error_message:
PL/SQL procedure successfully completed.
If you have looked at the output .. after the variable is intialized to 'N', still I am getting msgs displayed .. Hope this is clear .. Now can you suggest the solution...
Regards
Message was edited by:
Seshu
Message was edited by:
Seshu

Similar Messages

  • Best way to return complex datasets out of a procedure

    Dear Oracle experts,
    I'm presently writing on a procedure which should return a kind of datastructure which contains some rows of a table (SIGFacts) which are selected in dependence of
    a result set in a cursor.
    I would like to return this result set in a manner which enables external programs to
    fetch this data.
    What I tried in the procedure below is to create a record and make it accessible from external programs outside Oracle (see below).
    But I'm not sure whether this is a suitable method.
    I'm wondering about several questions :
    Is it suitable to give back a record or should I always give back a Cursor ?
    If I should give back a cursor, how could I fetch all the data within the record into a cursor ?
    And a stupid beginners question :
    How can I use the record from a external program ?
    (My procedure belongs to a package. The record is defined in the Package head ((see below))
    procedure PROCFINDINITIALSWITCHSTATE (SwitchID INTEGER, StartTime TIMESTAMP, ausgabe2 out nocopy SIGFACTTABLE) is
    cursor cursor0 (SwitchID Integer) is
    select var_ref from DynamicLines where BELONGSTOSWITCHID = SwitchID;
    cursor cursor1 (StartTime timestamp, VarRef Integer) RETURN SigFacts%ROWTYPE is
    Select * from SIGFacts where (NewValue=1) AND DT<= StartTime AND
    Var_ref = VarRef AND rownum = 1 order by DT DESC;
    tempRecord SIGFACTTYPE;
    tempTable SIGFACTTABLE;
    BEGIN
    tempTable := SIGFACTTABLE(); --Loeschen der tempTable (Initialisierung mit NULL)
    for datensatz in cursor0(SwitchID) loop
    for datensatz2 in cursor1 (StartTime, datensatz.Var_Ref) loop
    tempTable.extend(1); -- Hinzufuegen eines (zunaechst leeren) Datensatzes
    tempTable(tempTable.count).AUTOID := datensatz2.AUTOID;
    tempTable(tempTable.count).VAR_REF := datensatz2.VAR_REF;
    tempTable(tempTable.count).DT := datensatz2.DT;
    tempTable(tempTable.count).MACHINES_REF := datensatz2.MACHINES_REF;
    tempTable(tempTable.count).VARIABLESID := datensatz2.VARIABLESID;
    tempTable(tempTable.count).OLDVALUE := datensatz2.OLDVALUE;
    tempTable(tempTable.count).NEWVALUE := datensatz2.NEWVALUE;
    tempTable(tempTable.count).PRODUCTS_REF := datensatz2.PRODUCTS_REF;
    tempTable(tempTable.count).USERS_REF := datensatz2.USERS_REF;
    tempTable(tempTable.count).LINE_ID := datensatz2.LINE_ID;
    end loop;
    end loop;
    --return tempTable
    END PROCFINDINITIALSWITCHSTATE;
    I declared the Record in the Head section of the same package.
    type SIGFACTTYPE is record(
    AUTOID SIGFACTS.AUTOID%type, Var_Ref SIGFACTS.Var_ref%type, DT SIGFACTS.DT%type
    , machines_ref SIGFACTS.machines_ref%type, variablesid SIGFACTS.variablesid%type
    , oldvalue SIGFACTS.oldvalue%type,
    newvalue SIGFACTS.newvalue%type, products_ref SIGFACTS.products_ref%type
    , users_ref SIGFACTS.users_ref%type, line_id SIGFACTS.line_id%type
    type SIGFACTTABLE is table of SIGFACTTYPE;

    Dear Oracle experts,
    I'm presently writing on a procedure which should return a kind of datastructure which contains some rows of a table (SIGFacts) which are selected in dependence of
    a result set in a cursor.
    I would like to return this result set in a manner which enables external programs to
    fetch this data.
    What I tried in the procedure below is to create a record and make it accessible from external programs outside Oracle (see below).
    But I'm not sure whether this is a suitable method.
    I'm wondering about several questions :
    Is it suitable to give back a record or should I always give back a Cursor ?
    If I should give back a cursor, how could I fetch all the data within the record into a cursor ?
    And a stupid beginners question :
    How can I use the record from a external program ?
    (My procedure belongs to a package. The record is defined in the Package head ((see below))
    procedure PROCFINDINITIALSWITCHSTATE (SwitchID INTEGER, StartTime TIMESTAMP, ausgabe2 out nocopy SIGFACTTABLE) is
    cursor cursor0 (SwitchID Integer) is
    select var_ref from DynamicLines where BELONGSTOSWITCHID = SwitchID;
    cursor cursor1 (StartTime timestamp, VarRef Integer) RETURN SigFacts%ROWTYPE is
    Select * from SIGFacts where (NewValue=1) AND DT<= StartTime AND
    Var_ref = VarRef AND rownum = 1 order by DT DESC;
    tempRecord SIGFACTTYPE;
    tempTable SIGFACTTABLE;
    BEGIN
    tempTable := SIGFACTTABLE(); --Loeschen der tempTable (Initialisierung mit NULL)
    for datensatz in cursor0(SwitchID) loop
    for datensatz2 in cursor1 (StartTime, datensatz.Var_Ref) loop
    tempTable.extend(1); -- Hinzufuegen eines (zunaechst leeren) Datensatzes
    tempTable(tempTable.count).AUTOID := datensatz2.AUTOID;
    tempTable(tempTable.count).VAR_REF := datensatz2.VAR_REF;
    tempTable(tempTable.count).DT := datensatz2.DT;
    tempTable(tempTable.count).MACHINES_REF := datensatz2.MACHINES_REF;
    tempTable(tempTable.count).VARIABLESID := datensatz2.VARIABLESID;
    tempTable(tempTable.count).OLDVALUE := datensatz2.OLDVALUE;
    tempTable(tempTable.count).NEWVALUE := datensatz2.NEWVALUE;
    tempTable(tempTable.count).PRODUCTS_REF := datensatz2.PRODUCTS_REF;
    tempTable(tempTable.count).USERS_REF := datensatz2.USERS_REF;
    tempTable(tempTable.count).LINE_ID := datensatz2.LINE_ID;
    end loop;
    end loop;
    --return tempTable
    END PROCFINDINITIALSWITCHSTATE;
    I declared the Record in the Head section of the same package.
    type SIGFACTTYPE is record(
    AUTOID SIGFACTS.AUTOID%type, Var_Ref SIGFACTS.Var_ref%type, DT SIGFACTS.DT%type
    , machines_ref SIGFACTS.machines_ref%type, variablesid SIGFACTS.variablesid%type
    , oldvalue SIGFACTS.oldvalue%type,
    newvalue SIGFACTS.newvalue%type, products_ref SIGFACTS.products_ref%type
    , users_ref SIGFACTS.users_ref%type, line_id SIGFACTS.line_id%type
    type SIGFACTTABLE is table of SIGFACTTYPE;

  • Unable to use the values returned by a PL/SQL stored procedure in a XSQL page

    Hi,
    I've been messing around with XML and XSQL in particular. I was trying to write a xsql page to display a report with account totals...I have the following .xsql which calls a PL/SQL stored procedure :
    <?xml version="1.0"?>
    <xsql:query connection="pfcdm" xmlns:xsql="urn:oracle-xsql">
    <xsql:set-session-param name="zasset_total" value="100">
    <xsql:dml connection="pfcdm">
    rraman.sp_vw_id(zasset_total,zinvm_total,zmkt_val);
    </xsql:dml>
    </xsql:set-session-param>
    select 'Asset total is {@zasset_total}' as "ASSET_TOTAL" from dual
    </xsql:query>
    My procedure sp_vw_id returns the values that it should. But, I am not sure how to declare variables within a page, and to output the return values. There is very scanty documentation on the usage of <xsql:dml> or <xsql:ref-cursor-function>.
    Any response would be greatly appreciated.
    Thanks,
    Raja

    Here is the example from the Oracle9i (complete rewrite) of the XSQL Chapter in our Oracle documentation.
    Question
    I using <xsql:dml> to call a stored procedure which has one OUT parameter, but I was not able to see any results. The executed code results in the following statement:
    <xsql-status action="xsql:dml" rows="0"/>
    Answer
    You cannot set parameter values by binding them in the position of OUT variables in this release using <xsql:dml>. Only IN parameters are supported for binding. You can create a wrapper procedure that constructs XML elements using the HTP package and then your XSQL page can invoke the wrapper procedure using <xsql:include-owa> instead.
    For an example, suppose you had the following procedure:
    CREATE OR REPLACE PROCEDURE addmult(arg1 NUMBER,
    arg2 NUMBER,
    sumval OUT NUMBER,
    prodval OUT NUMBER) IS
    BEGIN
    sumval := arg1 + arg2;
    prodval := arg1 * arg2;
    END;You could write the following procedure to "wrap" it, taking all of the IN arguments that the procedure above expects, and then "encoding" the OUT values as a little XML datagram that you print to the OWA page buffer:
    CREATE OR REPLACE PROCEDURE addmultwrapper(arg1 NUMBER, arg2 NUMBER) IS
    sumval NUMBER;
    prodval NUMBER;
    xml VARCHAR2(2000);
    BEGIN
    -- Call the procedure with OUT values
    addmult(arg1,arg2,sumval,prodval);
    -- Then produce XML that encodes the OUT values
    xml := '<addmult>'&#0124; &#0124;
    '<sum>'&#0124; &#0124;sumval&#0124; &#0124;'</sum>'&#0124; &#0124;
    '<product>'&#0124; &#0124;prodval&#0124; &#0124;'</product>'&#0124; &#0124;
    '</addmult>';
    -- Print the XML result to the OWA page buffer for return
    HTP.P(xml);
    END;This way, you can build an XSQL page like this that calls the wrapper procedure:
    <page connection="demo" xmlns:xsql="urn:oracle-xsql">
    <xsql:include-owa bind-params="arg1 arg2">
    BEGIN addmultwrapper(?,?); END;
    </xsql:include-owa>
    </page>This allows a request like:
    http://yourserver.com/addmult.xsql?arg1=30&arg2=45
    to return an XML datagram that reflects the OUT values like this:
    <page> <addmult><sum>75</sum><product>1350</product></addmult>
    </page>

  • How can I return the nextval of a particular sequence from a stored procedure?

    I have a stored procedure that basically generates and records
    nextval into a table each time the procedure is called. I want
    to return this value in an out parameter. Is this possible? If
    so, how do I implement it?

    sq> create sequence s1 start with 1 increment by 1;
    procedure to get the nextval from a sequence:
    sql>create or replace procedure p1
    (seq_no_p OUT Number)
    is
    Begin
    select s1.nextval into seq_no_p from dual;
    End p1;
    to call the above procedure to get the out parameter(nextval):
    declare
    p number;
    begin
    p1(p);
    end;
    If this is what u want.
    Thiru

  • SOAP TO JDBC scenario: calling stored procedure which will return the value

    Hi
    I have Soap To Jdbc scenario in which I am going to call the Stored Procedure at target side which will be executed and it is going to return the result set .
    Result contains following values.
    return code as ( 0 Or 1) and also specific exception message if its return code as 1.
    Could you suggest me the way by which I can handled this return code and send it back to the Sap PI system then the same thing is directed the to SMTP server for sending mail to consern person.
    Regards
    Kumar

    The OUT parameters of stored procedure will be returned as response. Where exactly are you facing the proble? Here is a complete walkthourgh
    /people/luis.melgar/blog/2008/05/13/synchronous-soap-to-jdbc--end-to-end-walkthrough
    In your case, you don't want response at sender. Instead you want to mail it. For this you may use BPM to design your scenario with following steps
    Receive (to receive data from sender)
    Send Sync (to stored procedure and get response)
    Send Async (to mail receiver)
    Regards,
    Prateek

  • How to handle the procedure that reutrn object types as out parameter

    I have a procedure where it returns object(CREATE OR REPLACE TYPE xyz AS OBJECT) as a OUT parameter.
    Now i have to pull the data from this type and need to send the data in excel.
    Procedure will fetch data and assign it to object with lot of validations and local parameters variables..
    How can i push the data from the out parameter and need to send that in excel..Its an oracle database 10g..

    here's a basic example...
    SQL> set serveroutput on;
    SQL> create or replace type t_obj as object (x number, y number);
      2  /
    Type created.
    SQL> ed
    Wrote file afiedt.buf
      1  create or replace package mypkg as
      2    procedure testit(p_obj out t_obj);
      3    procedure callme;
      4* end;
      5  /
    Package created.
    SQL> ed
    Wrote file afiedt.buf
      1  create or replace package body mypkg as
      2    procedure testit(p_obj out t_obj) is
      3    begin
      4      p_obj := t_obj(1,2);
      5    end;
      6    procedure callme is
      7      v_obj t_obj;
      8    begin
      9      testit(v_obj);
    10      dbms_output.put_line('X='||v_obj.x||' Y='||v_obj.y);
    11    end;
    12* end;
    SQL> /
    Package body created.
    SQL> exec mypkg.callme;
    X=1 Y=2
    PL/SQL procedure successfully completed.
    SQL>

  • Verizon sent out an order I called to cancel, I returned the phones as they told me to, yet after months of calls, I am in the pre-collections stage

    So this journey started back in October. I was with sprint, and wanted out of their service, my contract was up, so I went with Verizon as they are the best in my area for service. My original order was for 2 iPhone 6's and an iPhone 5s. Upon finding out that I would only receive a $200 credit for my old iPhones if I bought only iPhone 6's, I called to cancel that order. Due to the fact the iPhone 6's were backordered they could not cancel my order, but they stated they would make notation on my account so that the order wouldn't ship. So, I then placed a new order for three iPhone 6's to qualify for the promotion. The beginning of November I received three boxes, and too my surprise, it was the first (original) order containing two iPhone 6's and an iPhone 5s. I called Verizon, and they said just send them back, don't open them. I was told there were return labels in the boxes, and there were not. So I then called the local Verizon store to see if I could return them there, they said, no it was an online order, so you have to send them back in. I then went to the website to print return labels, but both links where this was supposedly possible, the links did not work, dead links. At this point I called Verizon back who made a call on my behalf to the Verizon Store to return the phones there. I drove to the store, and when I got there, they suggested I just return the iPhone 5, as they had a 6 in stock, activate these phones, and cancel the second order, so I did. I then called and cancelled the second order, with the same issue, phones were backordered, so notation would be made to the account. Low and behold, 2 weeks later, 3 new iPhone 6's showed up at my door. So I went through the process again, calling customer service, canceling the service and having Verizon send me return labels for the phones. Five days later the return labels showed up, and I immediately returned the phones. I was told as soon as the phones were scanned by Fedex that a $635.97 refund would be issued to my card ( thats right two charges totaling almost $1300). Well that was not the case, It took a few weeks, but the refund was finally issued. Here's were the bigger problems begin, I received my first bill for those lines of service. I called Verizon as I thought this was odd, as the phones had never been out of the box or activated. So, phone call after phone call, Customer Service Rep after Customer Service Rep, I was told that the lines are now cancelled and you will be credited. Well a month goes by, and we are at the end of November, and I get a bill for over $500 dollars. I then call customer service again, tell them my story, stay on the line with patience waiting for the answer, and I am told again things are resolved. November 30th roles around, and I get another bill stating that my lines are disconnected due to non-payment. I call, and spend 52 minutes on the phone with a Customer Service Rep who tells me that everything is all set, he gives me the totals that are to be credited to my account, and I assume everything is well, as I receive no more letters or bills. Well flash forward to January 20, 2015, and I receive a call from an odd number, which turns out is a collection agency for Verizon, as my account is in pre-collections. Can you imagine my frustration, to be honest I am quite upset, so I again call customer service and get pushed to an account specialist. I relay my story, for and I am not joking, the 12th time, at which point I am informed that he cannot help me as the account is closed, and I will have to wait until 7am tomorrow morning to call back and speak with another account specialist. I am so frustrated with this entire situation, keep in mind I still have three active lines with Verizon that have been paid early every month since October. My real question is how many more times am I going to have to call to get this resolved? I have tried more than a dozen times to get this issue fixed, and here I am three months later still fighting this, it is just plain ridiculous and terrible business. How can you charge a customer for phones that he doesn't even have, thats right, I was issued a $635.97 refund on 11/13/2014, so how can I be charged for phones that were returned, and never taken out of the box. Also, how are they magically activated when they are still sealed in their original boxes. Needless to say I will continue to fight this issue, but rest assured, if this issue is not resolved tomorrow morning, I will be seeking legal counsel to fight these charges, as I do not want Verizon's poor customer service to harm my credit score that I have worked so hard to build to what it is now.
    Where is the help Verizon, because as of now, it is non existent.

        Thanks for the additional information AudiophileBen! Time is of the essence when it comes to special promotions. When did you process this purchase? If the promotion was not available when you purchased, then you are not eligible for it. I recommend visiting the store with your receipts showing your $100 discount if you purchased after the promotion started.
    AntonioC_VZW Follow us on Twitter at www.twitter.com/VZWSupport

  • I use Windows Vista. I cannot open icloud control panel. I get the message " the procedure entry point _objc_init_image could not be found in the dynamic link library objc.dll"  Any suggestions?

    error meessage "the procedure entry point _objc_init_image could not be located in the dynamic link library objc.dll"  Any suggestions? so I canot open icloud control panel.

    i ahve same problem

  • I bought the Adobe Photoshop Classroom in a Book for CS6 by accident and I have CC. I know, stupid mistake. But I can't take return the book. Is is similar enough to CC that I can still get use out of the book? Thank you so much

    I bought the Adobe Photoshop Classroom in a Book for CS6 by accident and I have CC. I know, stupid mistake. But I can't take return the book. Is is similar enough to CC that I can still get use out of the book? Thank you so much

    Each version of Adobe products builds upon the previous ones.  Some things like filters and advanced features may evolve or become deprecated over time, but the basic tools have remained pretty much the same for decades.  As long as you know there are subtle differences between versions, I think you will still get a great deal of value from C in a B for CS6.  
    Also refer to the CC online tuts
    Photoshop CC tutorials | Learn how to use Photoshop CC
    Learn Photoshop CC | Adobe TV
    Nancy O.

  • Display the procedure OUT value.

    CREATE OR REPLACE PROCEDURE test_xyz (p_acc_id IN NUMBER) IS
    p_status varchar2(20);
    begin
    if p_acc_id = 123
    DBMS_OUTPUT.PUT_LINE('STOP');
    end if;
    end test_xyz;
    this will display 'STOP' when i passed p_acc_id as 123.
    similarly...
    CREATE OR REPLACE PROCEDURE test_abc (
    p_acc_id IN NUMBER, p_status out varchar2) is
    begin
    if p_acc_id = 123
    p_status := 'STOP';
    end if;
    end test_abc;
    if i am using OUT in my procedure how i have to display the p_status vlaue.
    Thnak you....

    CREATE OR REPLACE PROCEDURE test_abc (
    p_acc_id IN NUMBER, p_status out varchar2) is
    begin
    if p_acc_id = 123
    p_status := 'STOP';
    end if;
    end test_abc;
    if i am using OUT in my procedure how i have to
    display the p_status vlaue.
    Thnak you....you forgot THEN after IF
    declare
    p_acc_id NUMBER := 123;
    p_status VARCHAR2(30);
    begin
    test_abc (p_acc_id, p_status );
    dbms_output.put_line(p_status);
    end;
    /** NOT TESTED ***
    Regards
    Dmytro
    Message was edited by:
    Dmytro Dekhtyaryuk

  • The power went out and when it returned the network name and password was lost.  I can see the network in my connections and connect to it.  How do I get it back to the orginal name and password.  I have an HP laptop

    The power went out and when it returned the network name and password was lost.  I can see the network in my connections and connect to it.  How do I get it back to the orginal name and password? I have an HP laptop. 

    Chances are, there was a signficant power surge or voltage fluctuation just before the power went out. This type of thing can cause the AirPort Extreme to reset back to default settings.
    If this occurs, your only option is re-configure the device again, just as you did originally.
    In order to improve your chances this next time this happens, (especially if you live in an area where thunderstorms are severe), a good quality surge suppressor / voltage limiting power strip will really help, and may save you the entire device or a nearby computer next time something like this occurs.

  • I just downloaded a video in HD, but I found out after the download was over my computer doesn't play HD videos. Is there any way I can return the video and get the SD version, or upgrade my computer so it will play the HD video?

    I just downloaded a video in HD, but I found out after the download was over my computer doesn't play HD videos. Is there any way I can return the video and get the SD version, or upgrade my computer so it will play the HD video?

    From http://support.apple.com/kb/HT3209
    When you purchase an HD video on a supported device or computer, only HD video will be downloaded. To download the SD version, you need to download the video again from your Purchased page. Conversely, if you purchase an HD video on an unsupported device, the SD version will be downloaded. Then, you will need to download the HD version from your Purchased page. Learn more about downloading previous purchases.

  • HT4796 Are there any unanticipated problems in carrying out the procedure outlined for 'Windows Migration Assistant'?

    Are there any unanticipated problems in carrying out the procedure outlined in the 'Windows Migration Assistant' instructions?

    One I have seen mentioned a couple of times is it will set up an identical user account on the Mac, which has led to some problems.
    I don't know how to fix this since I haven't used Windows since 1995.

  • I got problem on installing iTunes. When I clicked iTunes out, two windows popped out. One said the procedure entry point CFAttributed String Create Mutable could not be located in the dynamic link library Core Foundation.dll.

    I got problem on installing iTunes. When I clicked iTunes out, two windows popped out. One said the procedure entry point CFAttributed String Create Mutable could not be located in the dynamic link library Core Foundation.dll. and one just said *Itunes was not installed correctly.  Please re install I Tunes Error 7 (windows error 127) . I've tried uninstalling and reinstalling it. But either way cant work. I really need some of your help! PLS HELP ME!

    For general advice see Troubleshooting issues with iTunes for Windows updates.
    The error shares a similar pattern to that in the third box, so a similar approach should work. Look for CoreFoundation.dll in C:\Program Files (x86)\Common Files\Apple\Apple Application Support, delete it, then repair Apple Application Support.
    The steps in the second box are a guide to removing everything related to iTunes and then rebuilding it which is often a good starting point unless the symptoms indicate a more specific approach. Review the other boxes and the list of support documents further down page in case one of them applies.
    Your library should be unaffected by these steps but there is backup and recovery advice elsewhere in the user tip.
    tt2

  • Procedure Does not return expected new rows unless I ALTER the procedure it self

    Procedure Does not return expected new rows !!!   unless I ALTER the procedure it self

    And what exactly do you alter, the code / where clause / or ...?
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

Maybe you are looking for

  • How do i link individual web journal pages into an album or index?

    I've recently started playing with the Web Journal functionality on Aperture 3. I really like how I can select photos from within Aperture and it automatically creates an index page with thumbnails and a detail page for each photo which can include t

  • Fox Tabs and Add To Top Sites is not working. All my tabs have disppeared right after upgrading. Help!

    I upgraded to 11.0 and clicked to open tabs, which will take me to Fox Tabs, but I was unable to click any open. When I clicked Edit, every thing disappeared. When I clicked Done, the screen stated "Saving..." and it stayed like that for more than 5

  • Scheduling agreement,(GR value is wrong)

    I have one scheduling agreement, the price is 1.31 INR from 10.10.2007 and i made GR for this three times, it shows correct quantity and value in Purchase order history, in 18.10.2007 the one GR is showing me wrong value, per material isit, showing m

  • Help with dbms_xmlparser package

    Hello. release: SQL*Plus: Release 9.2.0.8.0 - Production on Jue Abr 5 22:50:21 2007 Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved. Conectado a: Oracle9i Enterprise Edition Release 9.2.0.8.0 - Production With the Partitioning, OLA

  • Runtime error when calling READ_TEXT FM

    Hi all, I tried to search this before I post my question. Please help. I have a subroutine which calls the 'READ_TEXT' FM to get the basic data text from material as follow: DATA tmp_matnr TYPE string. DATA matnr TYPE vbap-matnr. matnr = '27-10125-00