Trying to execute procedure from analoymous block

Hi ,
Iam trying to exeute the procedure from analymous block but I raising an exception
Could you please help me on this scenario.
Error report:
ORA-01001: invalid cursor
ORA-06512: at line 31
01001. 00000 -  "invalid cursor"

Hi,
FMI
<code>
   DECLARE
  pn_Result   NUMBER;
   pc_Cursor  SYS_REFCURSOR;
   SUBMIT_DATE DATE;
   REQUESTOR_NAME NVARCHAR2(200);
   approval_date DATE;
   APPROVER_NAME NVARCHAR2(200);
   REQUEST_TYPE_DESC NVARCHAR2(200);
   COMPANY_NAME NVARCHAR2(200);
    card_no NUMBER;
   card_user_name NVARCHAR2(200);
   company_embossed_name NVARCHAR2(200);
   auth_strat VARCHAR2(200);
   CARD_STATUS VARCHAR2(200);
   request_status VARCHAR2(200);
   BEGIN
   corporate.GET_CARD_REQUEST_SS
   (NULL,
   NULL,
   5,
   NULL,
   NULL,
   NULL,
   0,
   NULL,
   NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,pn_Result, pc_Cursor,NULL);
   FETCH pc_Cursor
   INTO
   REQUESTOR_NAME,
   approval_date,
   APPROVER_NAME,
   REQUEST_TYPE_DESC,
   COMPANY_NAME,
    card_no,
   card_user_name,
   company_embossed_name,
   auth_strat,
   CARD_STATUS,
   request_status;
   DBMS_OUTPUT.PUT_LINE( REQUESTOR_NAME);
   END;
<code>
My procedure is
<code>
create or replace
PROCEDURE           GET_CARD_REQUEST_SS
   ps_Req_First_Name IN NVARCHAR2,
   ps_Req_Last_Name IN NVARCHAR2,
   pn_Request_Type IN NUMBER,
   pn_Request_Status IN NUMBER,
   pn_Ageing IN NUMBER,
   pn_Ageing_compare IN NUMBER,
   pn_Application_Id IN NUMBER,
   ps_Embossed_Name IN NVARCHAR2,
   ps_Structure_Point IN NVARCHAR2,
   ps_Date_From IN VARCHAR2,
   ps_Date_To IN VARCHAR2,
   ps_Approver_Name IN NVARCHAR2,
   ps_Processor_Name IN NVARCHAR2,
   pn_Company_Id IN NUMBER,
   pn_Requestor_Or_Approver IN PLS_INTEGER,
   pn_callingUserId IN CST.T_USER_ID,
   pn_Screen_output IN PLS_INTEGER,
   pn_Result   OUT NUMBER,
   pc_Cursor   OUT CST.CUR_TYPE
   ,pn_iso_code IN NUMBER DEFAULT 826)
IS
   ls_Select varchar2(4000);
   ls_SelectFrom varchar2(4000);
   ls_Where varchar2(4000);
   ls_Order_By varchar2(4000);
   lb_Debug BOOLEAN := FALSE;
   ln_iso_code PLS_INTEGER ;
   C_CARD_REQUESTOR     CONSTANT PLS_INTEGER := 0;
   C_COMPANY_APPROVER   CONSTANT PLS_INTEGER := 1;
   C_BANK_APPROVER      CONSTANT PLS_INTEGER := 2;
BEGIN
   --if lb_Debug then
      PLSQL_LOG('card_request_admin.get_card_request: ---- Start at'|| to_char(sysdate,'YYYY-MM-DD HH24:MI:SS')  );
      PLSQL_LOG('card_request_admin.get_card_request:scheme user '|| SYS_CONTEXT('USERENV', 'session_user') );
      PLSQL_LOG('card_request_admin.get_card_request:user '|| SYS_CONTEXT('Godot','user')  );
      PLSQL_LOG('card_request_admin.get_card_request:company '|| SYS_CONTEXT('Godot','company')  );
      PLSQL_LOG('card_request_admin.get_card_request:node '|| SYS_CONTEXT('Godot','node')  );
      PLSQL_LOG('card_request_admin.get_card_request:bank '|| SYS_CONTEXT('Godot','bank')  );
      PLSQL_LOG('card_request_admin.get_card_request:mgr '|| SYS_CONTEXT('Godot','mgr')  );
      PLSQL_LOG('card_request_admin.get_card_request:provider '|| SYS_CONTEXT('Godot','provider')  );
      PLSQL_LOG('card_request_admin.get_card_request:verif_code '|| SYS_CONTEXT('Godot','verif_code')  );
      PLSQL_LOG('card_request_admin.get_card_request:Restriction '|| SYS_CONTEXT('Godot','Restriction')  );
      PLSQL_LOG('card_request_admin.get_card_request:execute development.security_set_context.set_context('|| SYS_CONTEXT('Godot','user')||','|| SYS_CONTEXT('Godot','company')||','||SYS_CONTEXT('Godot','node')||','||SYS_CONTEXT('Godot','bank')||','||SYS_CONTEXT('Godot','mgr')||','||SYS_CONTEXT('Godot','provider')||','||SYS_CONTEXT('Godot','verif_code')||','||SYS_CONTEXT('Godot','Restriction')||');'  );
      PLSQL_LOG('card_request_admin.get_card_request:ps_Req_First_Name   = '||ps_Req_First_Name   );
      PLSQL_LOG('card_request_admin.get_card_request:ps_Req_Last_Name    = '||ps_Req_Last_Name    );
      PLSQL_LOG('card_request_admin.get_card_request:pn_Request_Type     = '||pn_Request_Type     );
      PLSQL_LOG('card_request_admin.get_card_request:pn_Request_Status   = '||pn_Request_Status   );
      PLSQL_LOG('card_request_admin.get_card_request:pn_Ageing           = '||pn_Ageing           );
      PLSQL_LOG('card_request_admin.get_card_request:pn_Ageing_compare   = '||pn_Ageing_compare   );
      PLSQL_LOG('card_request_admin.get_card_request:pn_Application_Id   = '||pn_Application_Id   );
      PLSQL_LOG('card_request_admin.get_card_request:ps_Embossed_Name    = '||ps_Embossed_Name    );
      PLSQL_LOG('card_request_admin.get_card_request:ps_Structure_Point  = '||ps_Structure_Point  );
      PLSQL_LOG('card_request_admin.get_card_request:ps_Date_From        = '||ps_Date_From        );
      PLSQL_LOG('card_request_admin.get_card_request:ps_Date_To          = '||ps_Date_To          );
      PLSQL_LOG('card_request_admin.get_card_request:ps_Approver_Name    = '||ps_Approver_Name    );
      PLSQL_LOG('card_request_admin.get_card_request:ps_Processor_Name   = '||ps_Processor_Name   );
      PLSQL_LOG('card_request_admin.get_card_request:pn_Company_Id       = '||pn_Company_Id       );
      PLSQL_LOG('card_request_admin.get_card_request:pn_Requestor_Or_Approver = '||pn_Requestor_Or_Approver);
      PLSQL_LOG('card_request_admin.get_card_request:pn_callingUserId = '||pn_callingUserId);
      PLSQL_LOG('card_request_admin.get_card_request:pn_Screen_output = '||pn_Screen_output);
   --end if;
if pn_iso_code = 0 or pn_iso_code is NULL then
ln_iso_code := 826 ;
else
ln_iso_code := pn_iso_code;
end if;
   ls_Select := '
     select
          RM.SUBMIT_DATE
      ,DECODE(rm.requestor_super_user_id, NULL, NULL, ''Superuser on behalf of '') ||
          DECODE(RM.REQUESTOR_USER_ID, null, RD.FIRST_NAME || '' '' || RD.LAST_NAME, RU.FIRST_NAME || '' '' || RU.LAST_NAME ) as REQUESTOR_NAME
        ,DECODE(rm.request_status,
           '||cst.c_card_request_org_approve||', rm.company_approval_date,
           '||cst.c_card_request_bank_approve||', rm.bank_approval_date
           , NULL) as approval_date
        ,DECODE( RM.REQUEST_STATUS,
            :1, DECODE(rm.comp_apprvr_super_user_id, NULL, NULL, ''Superuser on behalf of '') ||CA.FIRST_NAME || '' '' || CA.LAST_NAME,
            :2, DECODE(rm.comp_apprvr_super_user_id, NULL, NULL, ''Superuser on behalf of '') ||CA.FIRST_NAME || '' '' || CA.LAST_NAME,
            :3, BA.FIRST_NAME || '' '' || BA.LAST_NAME,
            :4, BA.FIRST_NAME || '' '' || BA.LAST_NAME,
            null) as APPROVER_NAME
       ,nvl(L.TEXT_STRING, to_char(RM.REQUEST_TYPE))  as REQUEST_TYPE_DESC
        , decode(rm.bca_card_id,
            NULL,decode(rm.card_id, NULL,NULL ,(SELECT co_bca.name_desc FROM company co_bca,card bca WHERE bca.card_id = c.bca_card_id AND bca.company_id_external = co_bca.company_id )  ),
            (SELECT co_bca.name_desc FROM company co_bca,card bca WHERE rm.bca_card_id = bca.card_id AND bca.company_id_external = co_bca.company_id )
           )  as COMPANY_NAME
        ,SUBSTR(ENCRYPT_FD.decrypt_ext_company_id(co.external_company_id), 1, LENGTH(ENCRYPT_FD.decrypt_ext_company_id(co.external_company_id))-LENGTH(dp.data_provider))
        , DECODE(c.card_no,NULL,NULL,encrypt_fd.display_card_no(c.card_no)) AS card_no
        ,chu.first_name || '' '' || chu.last_name as card_user_name
        ,C.EMBOSSED_NAME || '' '' || C.EMBOSSED_LINE2 as company_embossed_name
        ,RD.HOME_ADDRESS_LINE_1, RD.HOME_ADDRESS_LINE_2, RD.HOME_ADDRESS_LINE_3, RD.HOME_ADDRESS_LINE_4 ||'' ''||RD.HOME_ADDRESS_LINE_5 as HOME_ADDRESS_LINE_4,
          RD.HOME_PHONE, RD.BUSINESS_PHONE ,RD.HOME_ADDRESS_COUNTRY
        ,decode (code.code,null,null,code.code||'' - ''|| code.description) as auth_strat
        ,RD.TOTAL_CREDIT_LIMIT
        ,code_card_status.description as CARD_STATUS
        ,rd.status_change_comment
        ,RM.CARD_REQUEST_ID
        ,decode (rm.request_status ,2,''For final approval'' ,3,''Approved'' ,4,''Rejected'' ,9,''Unsuccessful'' , -9, ''Reset failed'', to_char(RM.REQUEST_STATUS)) as request_status
        ,RM.REQUEST_TYPE
        ,rd.shipping_option
   IF pn_Screen_output = 1 THEN
    ls_Select := ls_Select || '
     ,TRUNC(SYSDATE, ''DD'') - TRUNC(RM.SUBMIT_DATE, ''DD'') as request_age
     , RM.UPDATE_TAG
     , c.card_id
     , rm.bca_card_id
     , rm.requestor_user_id
     , rm.request_status as request_status_int
     , decode(rm.bca_card_id, NULL,NULL, (SELECT ENCRYPT_FD.decrypt_ext_company_id(co_bca.external_company_id) FROM company co_bca,card bca WHERE rm.bca_card_id = bca.card_id AND bca.company_id_external = co_bca.company_id ) )  as external_company_id
   END IF;
   ls_SelectFrom := '
     FROM
      card_request_master rm
      ,card_request_data_view rd
      ,users ru
      ,users rsu
      ,users ca
      ,users ba
      ,company co
      ,provider dp
      ,product p
      ,card c
      ,request_type rt
      ,language_string l
      ,code
      ,users chu
      ,code code_card_status
   ls_Where := '
   WHERE RM.CARD_REQUEST_ID = RD.CARD_REQUEST_ID
      AND RM.REQUESTOR_USER_ID = RU.USER_ID(+)
      AND rm.requestor_super_user_id = rsu.user_id(+)
      AND RM.COMPANY_APPROVER_USER_ID = CA.USER_ID(+)
      AND RM.BANK_APPROVER_USER_ID = BA.USER_ID(+)
      AND RM.COMPANY_ID = CO.COMPANY_ID
      AND RM.CARD_ID = C.CARD_ID(+)
      AND C.PRODUCT_ID = P.PRODUCT_ID(+)
-- predicate_PRODUCT trick for performance
        and p.product_id in ( select distinct product_id from card )
      AND P.DATA_PROVIDER = DP.DATA_PROVIDER(+)
      AND RM.REQUEST_TYPE = RT.REQUEST_TYPE
      AND RT.STRING_ID = L.STRING_ID
      AND l.iso_code = '||ln_iso_code||'
      AND rm.auth_strat_code_id = code.code_id(+)
      AND chu.user_id(+) = c.user_id
      AND code_card_status.code_id(+) = rm.card_state_code_id
  IF pn_callingUserId IS NOT NULL THEN
    ls_Where := ls_Where || ' AND C.USER_ID != '||pn_callingUserId||' ';
  END IF;
   CASE pn_Requestor_Or_Approver
   WHEN C_CARD_REQUESTOR   THEN ls_Where := ls_Where || ' and RM.Requestor_User_Id = :5 ';
   WHEN C_COMPANY_APPROVER THEN ls_Where := ls_Where || ' AND RM.REQUESTOR_USER_ID != SYS_CONTEXT(''Godot'', ''user'') ' ;
   WHEN C_BANK_APPROVER    THEN ls_Where := ls_Where || ' and RM.Bank_Approver_User_Id = :5 ';
   END CASE;
   if ps_Req_First_Name is not null then
      ls_Where := ls_Where || ' and ( UPPER(RD.FIRST_NAME) like ''' || common.fix_odd_quotes(ps_Req_First_Name) || ''' or UPPER(RU.FIRST_NAME) like ''' || common.fix_odd_quotes(ps_Req_First_Name) || ''') ';
   end if;
   if ps_Req_Last_Name is not null then
      ls_Where := ls_Where || ' and ( UPPER(RD.LAST_NAME) like ''' || common.fix_odd_quotes(ps_Req_Last_Name) || ''' or UPPER(RU.LAST_NAME) like ''' || common.fix_odd_quotes(ps_Req_Last_Name) || ''') ';
   end if;
   if pn_Request_Type is not null then
      ls_Where := ls_Where || ' and RM.REQUEST_TYPE = ' || pn_Request_Type || ' ';
   end if;
   if pn_Request_Status is not null then
      ls_Where := ls_Where || ' and RM.REQUEST_STATUS = ' || pn_Request_Status || ' ';
   end if;
   if pn_Ageing is not null then
      ls_Where := ls_Where || ' and TRUNC(SYSDATE, ''DD'') - TRUNC(RM.SUBMIT_DATE, ''DD'') ' ;
      CASE
        WHEN pn_Ageing_compare = 1 THEN  ls_Where := ls_Where || ' < ';
        WHEN pn_Ageing_compare = 2 THEN  ls_Where := ls_Where || ' > ';
        WHEN pn_Ageing_compare = 3 THEN  ls_Where := ls_Where || ' = ';
        ELSE   ls_Where := ls_Where || ' != ';
      END CASE;
      ls_Where := ls_Where || pn_Ageing || ' ';
   end if;
   if ps_Embossed_Name is not null then
      ls_Where := ls_Where || ' and ( UPPER(RD.EMBOSSED_LINE1) like ''' || common.fix_odd_quotes(ps_Embossed_Name) || ''' or UPPER(RD.EMBOSSED_LINE2) like ''' || common.fix_odd_quotes(ps_Embossed_Name) || ''') ';
   end if;
   if ps_Structure_Point is not null then
      ls_Where := ls_Where || ' and UPPER(S.DESCRIPTION) like ''' || common.fix_odd_quotes(ps_Structure_Point) || ''' ';
   end if;
   if ps_Date_From is not null then
      ls_Where := ls_Where || ' and RM.SUBMIT_DATE >= to_date(''' || common.fix_odd_quotes(ps_Date_From) || ''', ''DD/MM/YY'') ';
   end if;
   if ps_Date_To is not null then
      ls_Where := ls_Where || ' and RM.SUBMIT_DATE <= to_date(''' || common.fix_odd_quotes(ps_Date_To) || ''', ''DD/MM/YY'') ';
   end if;
   if ps_Approver_Name is not null then
      ls_Where := ls_Where || ' and  UPPER(DECODE( RM.REQUEST_STATUS, '|| CST.C_CARD_REQUEST_ORG_APPROVE ||', CA.FIRST_NAME || '' '' || CA.LAST_NAME, '||CST.C_CARD_REQUEST_BANK_WITHDRAW||', CA.FIRST_NAME || '' '' || CA.LAST_NAME, '||CST.C_CARD_REQUEST_BANK_APPROVE||', BA.FIRST_NAME || '' '' || BA.LAST_NAME, '||CST.C_CARD_REQUEST_AT_PROCESSOR||', BA.FIRST_NAME || '' '' || BA.LAST_NAME, null)) like ''' || common.fix_odd_quotes(ps_Approver_Name) || ''' ' ;
   end if;
   --if ps_Processor_Name is not null then
   --   ls_Where := ls_Where || ' and UPPER(DP.NAME) like ''' || ps_Processor_Name || ''' ';
   --end if;
   if pn_Company_Id is not null then
      ls_Where := ls_Where || ' and RM.COMPANY_ID = ' || pn_Company_Id || ' ';
   end if;
   if lb_Debug then
      PLSQL_LOG( 'select count(*) ' || ls_SelectFrom || ls_Where );
   end if;
   CASE pn_Requestor_Or_Approver
   WHEN C_CARD_REQUESTOR   THEN
        execute immediate 'select count(*) ' || ls_SelectFrom || ls_Where
        into pn_Result using SYS_CONTEXT('Godot','user');
   WHEN C_COMPANY_APPROVER THEN
        execute immediate 'select count(*) ' || ls_SelectFrom || ls_Where
        into pn_Result;
   WHEN C_BANK_APPROVER    THEN
        execute immediate 'select count(*) ' || ls_SelectFrom || ls_Where
        into pn_Result;
   END CASE;
   if lb_Debug then
      PLSQL_LOG( 'CORPORATE.CARD_REQUEST_ADMIN.GET_CARD_REQUEST count: ' || pn_Result );
   end if;
   if pn_Result > 0 then
      ls_Order_By := ' Order By RM.SUBMIT_DATE ';
      if lb_Debug then
         PLSQL_LOG( ls_Select || ls_SelectFrom || ls_Where || ls_Order_By );
      end if;
      CASE pn_Requestor_Or_Approver
      WHEN C_CARD_REQUESTOR   THEN
           open pc_Cursor for ls_Select || ls_SelectFrom || ls_Where || ls_Order_By
           using CST.C_CARD_REQUEST_ORG_APPROVE, CST.C_CARD_REQUEST_BANK_WITHDRAW,
           CST.C_CARD_REQUEST_BANK_APPROVE, CST.C_CARD_REQUEST_AT_PROCESSOR,SYS_CONTEXT('Godot','user');
      WHEN C_COMPANY_APPROVER THEN
           open pc_Cursor for ls_Select || ls_SelectFrom || ls_Where || ls_Order_By
           using CST.C_CARD_REQUEST_ORG_APPROVE, CST.C_CARD_REQUEST_BANK_WITHDRAW,
           CST.C_CARD_REQUEST_BANK_APPROVE, CST.C_CARD_REQUEST_AT_PROCESSOR;
      WHEN C_BANK_APPROVER    THEN
           open pc_Cursor for ls_Select || ls_SelectFrom || ls_Where || ls_Order_By
           using CST.C_CARD_REQUEST_ORG_APPROVE, CST.C_CARD_REQUEST_BANK_WITHDRAW,
           CST.C_CARD_REQUEST_BANK_APPROVE, CST.C_CARD_REQUEST_AT_PROCESSOR;
      END CASE;
   end if;
  for i in pc_Cursor
  loop
  dbms_output.put_line(i.REQUESTOR_NAME);
  end loop;
EXCEPTION
   WHEN OTHERS THEN
      CORPORATE.COMMON.EXCEPTION_LOG( 'Procedure: CORPORATE.CARD_REQUEST_ADMIN.GET_CARD_REQUEST ', SQLCODE, SQLERRM, null, FALSE );
      pn_Result := SQLCODE;
END GET_CARD_REQUEST_SS;
<code>

Similar Messages

  • Error while executing procedure from the web

    Hi,
    <p>
    I am developing some procedures that I want to execute from an html form. The problem is that when I am trying to execute it in SQL Developer I got the following error:<br>
    Connecting to the database oracle.<br>
    ORA-06502: PL/SQL: numeric or value error<br>
    ORA-06512: at "SYS.OWA_UTIL", line 325<br>
    ORA-06512: at "SYS.OWA_UTIL", line 366<br>
    ORA-06512: at "MMARTA.INSERTPROJECT", line 3<br>
    ORA-06512: at line 10<br>
    Process exited.<br>
    </p>
    <p>
    The procedure is the following:<br>
    create or replace <br>
    procedure insertproject(jnum j.j#%type, jname j.jname%type, city j.city%type) as <br>
    begin <br>
    owa_util.mime_header('text/plain');<br>
    if jpak.insertj(jnum,jname,city)<0 then<br>
    htp.print('The jnum already exists in the database!');<br>
    else <br>
    htp.print('Insert successfull!');<br>
    end if;<br>
    end;<br>
    <br>
    and the function has the following code:
    <br>
    function insertj(jnum j.j#%type, jname j.jname%type, city j.city%type)<br>
    return number is<br>
    x number;<br>
    begin<br>
    Select count(*) into x From J<br>
    Where J#=jnum;<br>
    if x=0 then<br>
    insert into J values(jnum,jname,city);<br>
    commit;<br>
    return 0;<br>
    end if;<br>
    return -1;<br>
    END insertj;<br>
    </p>
    <p>
    Does anyone have any idea why I get this error?
    </p>
    <p>
    Thanks!
    <p/>

    Hi,
    <p>
    The function has the following parameters:<br>
    function insertj(jnum j.j#%type, jname j.jname%type, city j.city%type)<br>
    where j# is varchar2(5), jname is varchar2(35) and city is varchar2(35)<br>.
    I was trying to insert the following values:<br>
    j#:='J11', jname:='JobName' and city:='Paris'.<br>
    </p>
    <p>
    The procedure just calls this function with the same parameters. It is very strange because it is hard to see what the problem is. The line 10 is return 0 in the function where I believe the error comes from. It starts in the procedure and then goes in the function body, if I am interpreting this right.
    </p>
    <p>
    Any idea?
    </p>
    Thanks!

  • How to compile and execute procedure from hr to scott

    Hi all ,
    I am trying to compile and execute a stored procedure from hr user to scott user.
    first i gave grant command to hr.
    By using:- grant create any procedure to hr;
    After i compile a procedure from hr to scott.
    create or replace procedure scott.sp_hr
    is
    begin
    dbms_output.put_line('run by scott user');
    end;
    but it says :-
    ORA-01031: insufficient privileges
    01031. 00000 - "insufficient privileges"
    any one help me.

    it works for me
    20:29:29 SQL> 20:29:29 SQL> connect / as sysdba
    Connected.
    20:47:41 SQL> grant create any procedure to hr;
    Grant succeeded.
    20:48:01 SQL> connect hr/hr
    Connected.
    20:48:07 SQL> create or replace procedure scott.sp_hr
    is
    begin
    dbms_output.put_line('run by scott user');
    end;
    20:48:21   2  20:48:21   3  20:48:21   4  20:48:21   5  20:48:21   6 
    20:48:23   7  /
    Procedure created.
    20:48:25 SQL>

  • Execute procedure from forms

    Dear all,
    i want to execute a procedure from forms. my code is below for calling procedure, this code is working fine from the SQLPLUS, but not working from forms.
    forms_ddl('execute audit_sessions('||''''||'et20'||''''||',sysdate,'||''''||'HELP'||''''||')');my procedure is below
    CREATE OR REPLACE PROCEDURE audit_sessions(uname varchar2,logon_date date,APP_USER VARCHAR2) is
    begin
    insert into admin.session_audit values(uname,logon_date,APP_USER);
    commit;
    end;my table is below
    SQL> desc session_audit
    Name                    Null?    Type
    ACTIVE_DIRECTORY_USER            VARCHAR2(30)
    LOGON_TIME              NOT NULL DATE
    APPLICATION_USER        NOT NULL VARCHAR2(30)kindly help. i am using oracle 10g database and forms version 9.0.4.0.19
    Regards.
    Edited by: Maahjoor on 09-Feb-2013 19:34
    Edited by: Maahjoor on 09-Feb-2013 19:35
    Edited by: Maahjoor on 09-Feb-2013 20:18

    Wa Alaikum Salam,
    Dear Ahmad Rafiq,
    it is compiled without error, so i think it should work, but now currently the forms is opened by some user,
    as soon as i am able to delete the old one and paste the current one, i will update you and will mark the answer correct accordingly.
    thank you so much dear.

  • Execute immediate issue while calling a procedure from plsql block

    Hi all,
    I have the following simple code ,my execute immediate is not working(I am pasting the error below as well)
    CREATE OR REPLACE PROCEDURE CALL_RAHUL_PROCEDURES
    AS
    strng varchar2(1000);
    BEGIN
    for i in (select proc_name,flag,id from rahul_procedures order by id)
    loop
    if (i.flag = 'Y')
    then
    strng := 'exec '||i.proc_name||'(''rahul'')';
    dbms_output.put_line(strng);
    execute immediate strng;
    end if;
    end loop;
    END CALL_RAHUL_PROCEDURES;
    Error:
    Connecting to the database INQDWD.
    ORA-00900: invalid SQL statement
    ORA-06512: at "ETLADMIN.CALL_RAHUL_PROCEDURES", line 17
    ORA-06512: at line 2
    exec RAHUL_HELLO_WORLD2('rahul');
    Process exited.
    Disconnecting from the database INQDWD.
    data in rahul_procedures table :
    Proc_name flag Id
    RAHUL_HELLO_WORLD     N     1
    RAHUL_HELLO_WORLD2     Y     2
    RAHUL_HELLO_WORLD     N     3
    RAHUL_HELLO_WORLD3     N     4
    please help.
    Regards
    Rahul

    Mac_Freak_Rahul wrote:
    Well I have to call 26 procedures one by one and the names of the procedures would be in a table'rahul_procedures' Which is 100% wrong.
    Data is stored in tables, program code is stored in procedures or view defintions.
    http://en.wikipedia.org/wiki/Data_%28computing%29
    >
    Data vs programs
    Typically, different files are used to store programs vs data. Executable files contain programs; all other files are data files.
    >
    So you have just violated the primary distinction between data and program code.
    I dont find anything strange in my question,Only because you do not appear to know what you are doing or the difference between data and program code.
    http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:1943344500346351703
    >
    ugh, what an ugly "design". I can see your life will be full of performance issues, strange 'bugs', and other unpleasant side effects. I mean, it all looks "so cool", but it'll be a nightmare to maintain and enhance.
    but then you have the issue of binds, which will be intractable. You'd have to know the binds at compile time, but you have hidden all of your sql in a magic generic table - so you cannot possibly know your binds at compile time.
    I would suggest you discard all of this code (I am DEAD SERIOUS) and start over. This is a bad idea from the get go. Or at least do me a favor and do not use plsql (you make it look like a good database implementation, but it isn't)
    The objective here is to store SQL Statements in a Table(a sql repository) and just call the required SQL from the application using the sqlid using the sql_execute procedure. ...
    CHANGE YOUR OBJECTIVE.
    How about this for a good objective:
    the objective here is to store sql statement in a plsql routine (a sql repository, you call a procedure and we run sql) and just call the required sql form the applicatoin using the STORED PROCEDURE
    sorry, can I think of hacks to get you going? yes, application contexts come to mind - a fixed number of binds comes to mind. Am I going to work them out? No - it is the wrong way to approach a database application.

  • PLS-00306,problem while executing procedure from oracle e_comerce

    Hi
    I have writen a procedure in oracle.Tere i have a parameter with type varchar2.
    While i registered it in e_comerce i choosed the value set as 15characters.
    When i am runing the program from my ecomerce application it gives an error as below:
    ORACLE error 6550 in FDPSTP
    Cause: FDPSTP failed due to ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'PO_OUTPUT'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    there is no error when i am executing my procedure in toad/sql+ but this error comes only in e_comerce application.
    PLease tell what is the reason and what can be the solution?

    Hi,
    <p>
    The function has the following parameters:<br>
    function insertj(jnum j.j#%type, jname j.jname%type, city j.city%type)<br>
    where j# is varchar2(5), jname is varchar2(35) and city is varchar2(35)<br>.
    I was trying to insert the following values:<br>
    j#:='J11', jname:='JobName' and city:='Paris'.<br>
    </p>
    <p>
    The procedure just calls this function with the same parameters. It is very strange because it is hard to see what the problem is. The line 10 is return 0 in the function where I believe the error comes from. It starts in the procedure and then goes in the function body, if I am interpreting this right.
    </p>
    <p>
    Any idea?
    </p>
    Thanks!

  • Execute procedure from htp.form

    Hi
    How do i execute a procedure with the parameter value passed in from a form?? Please help.. thanks!
    htp.formOpen(owa_util.get_owa_service_path||'procedure_name');
    htp.formText('p_username', 10, 10);
    htp.formSubmit;
    htp.formClose;

    The PL/SQL block above generates an HTML form. The HTML form is submitted from the browser to a URL, defined by the form's action. On the receiving end, you must have a PL/SQL procedure with the right name and parameter(s) that can process the request submitted by the form.
    In your case, you must have a procedure, called "procedure_name", as specified in the formOpen call. It must take a parameter, called "p_username", as defined by your text input field (formText).
    Hope this helps,
    Peter

  • Permisssion for executing procedure from different schema

    Hi ,
    I am executing following procedure in different package and, I am getting error. Following procedure and error:
    Procedrue:
    DECLARE
    l_tbl_timecard_info APPS.HXC_self_service_time_deposit.timecard_info;
    l_tbl_attributes_info APPS.HXC_self_service_time_deposit.app_attributes_info;
    l_tbl_messages APPS.HXC_self_service_time_deposit.message_table;
    l_new_timecard_id NUMBER;
    l_new_timecard_ovn NUMBER;
    l_time_building_block_id APPS.HXC_time_building_blocks.time_building_block_id%TYPE;
    begin
    --FND_GLOBAL.APPS_INITIALIZE( user_id => 12345,resp_id => 56789,resp_appl_id => 809 );
    APPS.HXC_timestore_deposit.create_time_entry ( p_measure=> 7, p_day => APPS.fnd_date.canonical_to_date ('2002/09/02'), p_resource_id=> 9389, -- Identifies a person on our DB, REPLACE WITH YOUR IDs
    p_app_blocks=> l_tbl_timecard_info, p_app_attributes=> l_tbl_attributes_info, p_time_building_block_id=> l_time_building_block_id);
    end;
    Error:
    Error starting at line 1 in command:
    DECLARE
    l_tbl_timecard_info APPS.HXC_self_service_time_deposit.timecard_info;
    l_tbl_attributes_info APPS.HXC_self_service_time_deposit.app_attributes_info;
    l_tbl_messages APPS.HXC_self_service_time_deposit.message_table;
    l_new_timecard_id NUMBER;
    l_new_timecard_ovn NUMBER;
    l_time_building_block_id APPS.HXC_time_building_blocks.time_building_block_id%TYPE;
    begin
    --FND_GLOBAL.APPS_INITIALIZE( user_id => 12345,resp_id => 56789,resp_appl_id => 809 );
    APPS.HXC_timestore_deposit.create_time_entry ( p_measure=> 7, p_day => APPS.fnd_date.canonical_to_date ('2002/09/02'), p_resource_id=> 9389, -- Identifies a person on our DB, REPLACE WITH YOUR IDs
    p_app_blocks=> l_tbl_timecard_info, p_app_attributes=> l_tbl_attributes_info, p_time_building_block_id=> l_time_building_block_id);
    end;
    Error report:
    ORA-00942: table or view does not exist
    ORA-06512: at "APPS.HXC_TIMESTORE_DEPOSIT_UTIL", line 1519
    ORA-06512: at "APPS.HXC_TIMESTORE_DEPOSIT_UTIL", line 1599
    ORA-06512: at "APPS.HXC_TIMESTORE_DEPOSIT", line 1233
    ORA-06512: at "APPS.HXC_TIMESTORE_DEPOSIT", line 1327
    ORA-06512: at line 10
    00942. 00000 - "table or view does not exist"
    *Cause:   
    *Action:                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    The schema on which you are running this procedure do not have the access to the tables that you are referring in this procedure.

  • Execute procedure problem

    Hi,
    I have this problem.
    I have one procedure on first database (9.2.0.7) which is calling second procedure from it's body on second database (8.1.6.3.0) using dblink.
    When I connect from my client node (10.2.0.4 Oracle client) on first database everything is OK, I execute procedure and I get some results, because I have four output values from procedure.
    Problem is when I have tried to execute procedure from first database using it's client 9.2.0.7, I just don't get any output from it, but also I don't get any error.
    It's look like that there is some communication problem between 9.2.0.7 and 8.1.6.
    Example>
    1) Good output:
    execute vpku.pom_bscs_potr('190900641213696', '6275,07');
    b_r 19-090-064-1213696
    i_f 6275,07
    out1 6275,07
    out2 01/02/2009
    out3 N
    out4 1.1296014
    PL/SQL procedure successfully completed.
    2) Problematic output
    execute vpku.pom_bscs_potr('190900641213696', '6275,07');
    b_r
    i_f
    out1
    out2
    out3
    out4
    PL/SQL procedure successfully completed.
    Any idea,
    Thanks.

    Hi,
    What is the second parameter? Is this a number field? If so I think the problem will be setting of your environment, NLS_NUMERIC_CHARACTERS or THE NLS_LANGUAGE. This will define the decimal seperator, which I think is different on the two clients.
    First thing to do, drop the above mentioned solution of an exception handling. This will hopefully yield the real error. Possibly ORA-01722, Invalid number.
    Herald ten Dam
    Superconsult.nl

  • PL/SQL: Executing a procedure from within another procedure

    Hello, I'm a newbie and I need help on how to execute procedures from within another procedure. The procedure that I call from within the procedure have return values that I want to check.
    I tried: EXECUTE(user_get_forum_info(p_forumid, var_forum_exists, var_forum_access, var_forumname));
    but I get the error message:
    PLS-00103: Encountered the symbol "USER_GET_FORUM_INFO" when expecting one of the following::= . ( @ % ; immediate
    The symbol ":=" was substituted for "USER_GET_FORUM_INFO" to continue.
    And when I tried: EXECUTE(user_get_forum_info(p_forumid, var_forum_exists, var_forum_access, var_forumname));
    I get the error message:
    PLS-00222: no function with name 'USER_GET_FORUM_INFO' exists in this scope
    PL/SQL: Statement ignored
    The procedure USER_GET_FORUM_INFO exists. (don't understand why it says "no FUNCTION with name", it's a procedure I'm executing)
    I'm stuck so thanks for any help...
    Below is all the code. I'm using Oracle 9i on RedHat Linux 7.3.
    ================================================================================
    CREATE OR REPLACE PROCEDURE user_forum_requestsaccess (
    p_forumid IN NUMBER,
    p_requestmessage IN VARCHAR2
    AS
    var_forumid NUMBER;
    var_forum_exists NUMBER;
    var_forum_access NUMBER;
    request_exists NUMBER;
    var_forumname VARCHAR2(30);
    FORUM_DOESNT_EXIST EXCEPTION;
    FORUM_USER_HAS_ACCESS EXCEPTION;
    FORUM_REQUEST_EXIST EXCEPTION;
    BEGIN
    SELECT SIGN(NVL((SELECT request_id FROM forum.vw_all_forum_requests WHERE forum_id = p_forumid AND db_user = user),0)) INTO request_exists FROM DUAL;
    EXECUTE(user_get_forum_info(p_forumid, var_forum_exists, var_forum_access, var_forumname));
    IF var_forum_exists = 0 THEN
    RAISE FORUM_DOESNT_EXIST;
    ELSIF var_forum_access = 1 THEN
    RAISE FORUM_USER_HAS_ACCESS;
    ELSIF request_exists = 1 THEN
    RAISE FORUM_REQUEST_EXIST;
    ELSE
    INSERT INTO tbl_forum_requests VALUES (SEQ_TBL_FORUM_REQ_REQ_ID.NEXTVAL, SYSDATE, p_requestmessage, p_forumid, user);
    INSERT INTO tbl_forum_eventlog VALUES (SEQ_TBL_FORUM_EVNTLOG_EVNT_ID.NEXTVAL,SYSDATE,1,'User ' || user || ' requested access to forum ' || var_forumname || '.', p_forumid,user);
    COMMIT;
    END IF;
    EXCEPTION
    WHEN
    FORUM_DOESNT_EXIST
    THEN RAISE_APPLICATION_ERROR(-20003,'Forum doesnt exist.');
    WHEN
    FORUM_USER_HAS_ACCESS
    THEN RAISE_APPLICATION_ERROR(-20004,'User already have access to this forum.');
    WHEN
    FORUM_REQUEST_EXIST
    THEN RAISE_APPLICATION_ERROR(-20005,'A request to this forum already exist.');
    END;
    GRANT EXECUTE ON user_forum_requestsaccess TO forum_user;
    ================================================================================
    Regards Goran

    you don't have to use execute when you want to execute a procedure (only on sql*plus, you would use it)
    just give the name of the funtion
    create or replace procedure test
    as
    begin
        dbms_output.put_line('this is the procedure test');
    end test;
    create or replace procedure call_test
    as
    begin
        dbms_output.put_line('this is the procedure call_test going to execute the procedure test');
        test;
    end call_test;
    begin
        dbms_output.put_line('this is an anonymous block calling the procedure call_test');
        call_test;
    end;
    /

  • Execute proceduere from block

    Hi,
    We have oracle 10g On windows.
    we need to execute a procedure from anonimous block. requiement is like below
    if condition
    yes then execute procedure
    else
    do not execute procedure.
    How we can impliment this.

    968136 wrote:
    chanchal,
    just try this...
    here i have created on procedure and i am calling this procedure from anonymous block.
    create or replace procedure samp_block(date1 out varchar2)
    as
    begin
    select sysdate into date1 from dual;
    end;
    declare
    v_date date;
    v_no number:=1;
    begin
    if (v_no=1) then
    samp_block(v_date);
    dbms_output.put_line(v_date);
    else
    null;
    end if;
    end;
    Regards,
    Ramadurga
    Edited by: 968136 on Nov 2, 2012 3:37 PMHi Ramadurga,
    what is the reason to write something like:
    ELSE
       NULL;
    END IF;You can simply omit it the ELSE part.
    Regards.
    Al
    Edited by: Alberto Faenza on Nov 2, 2012 11:13 AM

  • How to execute another schema procedure from toad?

    Hi,
    i want to execute procedure from another schema from toad. already i have created synonym for that procedure and provided execute permission.
    how to execute procedure from toad?
    Thanks,

    Hi,
    The vendor of that product is running their own forums
    http://toadfororacle.com/index.jspa
    Not sure how they feel about
    Handle:      user2017273
    Status Level:      Newbie
    Registered:      Oct 4, 2009
    Total Posts:      64
    Total Questions:      44 *(36 unresolved)*

  • Run Procedure From a Report

    Hi All,
    I have what seems like a simple question. How do you run a procedure from reports? I have a procedure that I would like to pass some user defined parameters to from the parameter form, then run the procedure. The procedure populates a table that the report uses as a source for its data. In theory you should be able to give global values to your parameters and them use an after parameter form/before report trigger that kicks off your procedure. I have tried those "execute" commands from the reports help but no luck.
    Does anyone have the answer?
    Cheers,
    Bradley

    Hi Bradley,
    You would run the procedure like you would run a procedure in PL/SQL. Which means you should not include the word "execute".
    procedure_name(:p_param1,:p_param2);
    I hope this helps,
    Tom

  • Error in Executing Procedure through DBLink

    Hi,
    I am facing some problems in executing a procedure through DBLink.
    I have two schema A and B in two different database.
    In schema A I am having one procedure X in package Y and my requirement is that I want to execute this procedure in schema B. So in schema B i have created one DBLink ABC and trying to execute procedure X using this DB link.
    begin
    A.Y.X@ABC;
    end;
    But I am getting below error:
    ORA-06550: line 2, column 1:
    PLS-00201: identifier 'A.Y.X@ABC' must be declared
    ORA-06550: line 2, column 1:
    PL/SQL: Statement ignored
    Any help would be greatly appreciated!
    Thanks In Advance..
    Regards,
    Sachin Bansal

    Hi,
    Yes, I am connecting to user A of DB1 and in this user I am having procedure X in Package Y. My DBLink in Schema B of DB2 is pointing to user A of DB1.
    I have created DBLINK using below script:
    create public database link abc
    connect to A
    identified by A
    using '(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=XXX)(PORT=1521)))(CONNECT_DATA=(service_name=XXX)))';
    Above DBLInk is working fine..I am able to access all the table of schema A in schema B using this DBLink. But when I trying to execute any procedre of schema A in schema B then i am getting error.
    Regards,
    Sachin

  • Execute Excel from ITS

    I'm trying to execute Excel from a ITS transaction using the GUI_EXEC, GUI_RUN or WS_EXECUTE functions I get a 'Select Program' dialog box from windows. I then have to find and select 'excel.exe' for it to work. Is there anyway to avoid the windows dialog box? It works find from SAPGUI.
    Here's my code:
          data: PATHNAME LIKE SOXPC-PATH.
        Check where the Excel is
          CALL FUNCTION 'SO_PROGNAME_GET_WITH_PATH'
               EXPORTING
                    DOCTYPE  = 'XLS'
               IMPORTING
                    PATHNAME = PATHNAME
               EXCEPTIONS
                    OTHERS   = 1.
        Call Excel
          CALL FUNCTION 'WS_EXECUTE'
               EXPORTING
                    PROGRAM     = PATHNAME
                    COMMANDLINE = 'S:\0004.xls'
                    INFORM      = 'X'  
               EXCEPTIONS
                    OTHERS      = 1.
    Thanks,
    Jaed

    If you wanted to role the execookie.txt file out to your user community, assuming they all use Internet Explorer, you could role a file which lets IE determine which application to launch.  The following file worked for me:
    TXT
    c:\Program Files\Internet Explorer\iexplore.exe
    JPG
    c:\Program Files\Internet Explorer\iexplore.exe
    JPEG
    c:\Program Files\Internet Explorer\iexplore.exe
    GIF
    c:\Program Files\Internet Explorer\iexplore.exe
    DOC
    c:\Program Files\Internet Explorer\iexplore.exe
    BMP
    c:\Program Files\Internet Explorer\iexplore.exe
    PDF
    c:\Program Files\Internet Explorer\iexplore.exe
    TIF
    c:\Program Files\Internet Explorer\iexplore.exe
    PPT
    c:\Program Files\Internet Explorer\iexplore.exe
    PPS
    c:\Program Files\Internet Explorer\iexplore.exe
    XLS
    c:\Program Files\Internet Explorer\iexplore.exe

Maybe you are looking for

  • Editable field in a Adobe Form

    Hi, guys. I gotta insert an editable field in an adobe print form, but I can't make it editable. I selected 'User Entered- Required' in the 'Value' palette of the field, but, after the launch of the program, it's not editable yet. I also tried to val

  • Can I use a US-122MKII with Logic Pro x?

    Hi All! This is my first time on here so nice to meet you My question is: Can I use the TASCAM US-122MKII with the new Logic Pro x on an iMac? I've been using the TASCAM with my old Powerbook running Logic Pro 9 and it worked fine. Now however I can'

  • How can I get Vendor Balances to Payroll

    Dear Experts, I  came across a scenario, My client is paying some ammount in behalf of employee like Mobile Bill and keeping this ammount in Vendor account, How can I take that Balance in to payroll to deduct in Payroll? is there any Standard way of

  • K9N4-SLI video question

    I'm real close to buying the MSI K9n4-SLI-F MB. I dl'ed the manual and it seams to say that the PCIE 16x slots are only supported at 8X speed. I understand if that is true while in SLI, but is the 1st slot running at 16x with one vid card? Thanks

  • Elements 12 crashing when trying to play a slideshow.

    I just upgraded from Photoshop Elements 9 to PSE 12. (Oddly PSE remains installed which was unexpected. Most apps that I upgrade replace their previous version). When I try to use the slideshow feature, usually while displaying the first photo, the p