Use OCIDescribeAny to describe Procedure in a package?

I used the following code retrieve the parameter information for
procedures:
OCIDescribeAny(svchp, errhp, objptr, objp_len, OCI_OTYPE_NAME,0,
          OCI_PTYPE_PROC, deschp);
if (OCIAttrGet(deschp, OCI_HTYPE_DESCRIBE, &parmh, 0,
OCI_ATTR_PARAM, errhp))
          return ;
     if (OCIAttrGet(parmh, OCI_DTYPE_PARAM, &arglst, 0,
OCI_ATTR_LIST_ARGUMENTS, errhp))
          return ;
     if (OCIAttrGet(arglst,OCI_DTYPE_PARAM, &numargs, 0,
OCI_ATTR_NUM_PARAMS, errhp))
          return ;
If I pass a procedure which exists in a package, I will get a
object does not exist error. How can I describe a procedure in a
package using OCIDescribeAny ? Thanks.

I tested it in the SQL Worksheet (rather than the PL/SQL editor), but I see the same behaviour as you when I try with your example in the PL/SQL editor. A little testing suggests that the problem is that the completion insight doesn't understand the context of where it is in the PL/SQL and so doesn't know what options to list.
If I try adding the end for the new procedure and then going back to after the "(":procedure Proc_test_call
is
begin
pkg_test2.proc_test2(
end proc_test_call;I just get begin and declare as options - ie completion insight thinks I am no longer in scope of the package (as other package components not listed) and starting a new block.
If I try adding an assignment before the procedure call (not logical, I know, but I had been testing with a function in my schema):procedure Proc_test_call
is
begin
  result := pkg_test2.proc_test2(I get what we should (parameters for proc_test2 and local scope items).
Your workaround of adding the closing backet for the procedure call helps the completion insight understand the context of where it is and so it can give the right options.
I have previously avoided parameter completion insight as earlier versions had big performance problems when connected to a schema with a large number of PL/SQL objects (our main schema has 5.5 million records in all_arguments), but the performance has certainly been fixed. However, the PL/SQL editor still seems pretty hit and miss as to whether the parameter completion insight works, which seems largely to be because it doesn't always the context of where it is in the PL/SQL.
theFurryOne

Similar Messages

  • Using spool in a procedure

    Hi,
    I've a package with 6 procedures.
    In one procedure I need to load the data into a flat file. The procedure contains only one select statement.
    example:
    procedure pro_test as
    select * from emp;
    end pro_test;
    Shell script is being used to call one procedure inside the package and that procedure is calling remaining procedures inside it.
    connected to database using sqlplus.
    Can anyone help me out how I can spool the select statement inside the procedure. Version of oracle is 11g.

    Hi,
    Why do you want to do
    SELECT  *
    FROM    table_name;
    inside the procedure?  Why not have your script run the procedure (without the query above), and then do that query afterwards, when you can use SPOOL to put the results in a file?
    If you really must write a file from a procedure, here's an example of how to use utl_file.
    First, SYSTEM (or some other user with the CREATE ANY DIRECCTORY system privilege) must create a directory, and grant privileges to use it.  For example:
    CREATE OR RPLEACE DIRECTORY  a_dir  AS 'C:\Foo\A_Folder';
    GRANT ALL ON DIRECTORY  a_dir  TO PUBLIC;
    Typically, SYSTEM does this once, and other people use it hundreds of times.
    You might create a file in that directory like this:
    CREATE OR REPLACE PROCEDURE  write_dept
    IS
        f  utl_file.file_type;
    BEGIN
        f := utl_file.fopen ('A_DIR', 'Dept.txt', 'W');
        FOR  r  IN  (  SELECT  *
                       FROM    scott.dept
        LOOP
            utl_file.put_line ( f
                              , TO_CHAR (r.deptno, 'FM00')
                                || ' '
                                || RPAD (r.dname, 15)
                                || r.loc
        END LOOP;
        utl_file.fclose (f);
    END  write_dept;
    SHOW ERRORS

  • OCIDescribeAny() to describe a package

    I tried to retrieve information about a package using
    OCIDescribeAny(). My problem is when there is only one procedure
    inside a package, my code doesn't work.If there are over two
    procedures inside a package,my code can retrieve some of
    proceures,then crashed. the following is part of code to
    retrieve the information.Can any one help me to solve this
    problem?
    static void describe_package()
         // package to be described
         text *objptr;
         ub4 objp_len;
         OCIParam* parmh;//parameter handle
         OCIParam* arglst;     //level 0 arguemnt list handle
         OCIParam* arglst1;     //level 1 arguemnt list handle     
         OCIParam* arglst2;//level 2 arguemnt list handle
         OCIParam* arglst3;//level 3 arguemnt list handle
         OCIParam* arg;//level 0 arguemnt handle     
         OCIParam* arg1;//level 1 arguemnt handle
         OCIParam* arg2;//level 2 arguemnt handle
         OCIParam* arg3;//level 3 arguemnt handle
         ub2 numargs, numargs1,numargs2, numargs3;
         ub4 namelen, namelen1, namelen2, namelen3;
         ub4 i, j, k, m;
         //ub2     arglst_type;
         text* name;
         text* name1;
         text* name2;
         text* name3;
         sword retval;
         objptr = pkgname;
         objp_len = strlen(objptr);
         //describe handle
         checkerr (errhp, OCIHandleAlloc((dvoid *) envhp, (dvoid
    **) &dschp,
    (ub4) OCI_HTYPE_DESCRIBE,
    (size_t) 0, (dvoid **) 0));
         if ((retval = (OCIDescribeAny(svchp, errhp, objptr,
    objp_len, OCI_OTYPE_NAME,0,
                                  OCI_PTYPE_PKG,
    dschp))) != OCI_SUCCESS)
              if (retval == OCI_NO_DATA)
              printf("NO DATA: OCIDescribeAny on %s\n",
    &objptr);
         else
    /* OCI_ERROR */
              printf( "ERROR: OCIDescribeAny on %s\n",
    &objptr);
              checkerr(errhp, retval);
              return;
         if (OCIAttrGet(dschp, OCI_HTYPE_DESCRIBE, &parmh, 0,
    OCI_ATTR_PARAM, errhp))
              return ;
         if (OCIAttrGet(parmh, OCI_DTYPE_PARAM, &arglst, 0,
    OCI_ATTR_LIST_SUBPROGRAMS, errhp))
              return ;
         //if (OCIAttrGet(arglst,OCI_DTYPE_PARAM, &numargs, 0,
    OCI_ATTR_NUM_PARAMS, errhp))
         //     return ;
         if (arglst)
              OCIAttrGet(arglst,OCI_DTYPE_PARAM, &numargs, 0,
    OCI_ATTR_NUM_PARAMS, errhp);
              for (i = 1; i <= numargs; i++)
                   OCIParamGet (arglst, OCI_DTYPE_PARAM,
    errhp, &arg, i);
                   OCIAttrGet (arg, OCI_DTYPE_PARAM, &name,
    &namelen, OCI_ATTR_NAME, errhp);
                   OCIAttrGet (arg, OCI_DTYPE_PARAM,
    &arglst1, 0, OCI_ATTR_LIST_ARGUMENTS, errhp);               
                   if (arglst1)
                        OCIAttrGet
    (arglst1,OCI_DTYPE_PARAM, &numargs1, 0, OCI_ATTR_NUM_PARAMS,
    errhp);
                        for (j = 1; j <= numargs1; j++)
                             OCIParamGet (arglst,
    OCI_DTYPE_PARAM, errhp, &arg1, j);
                             OCIAttrGet (arg1,
    OCI_DTYPE_PARAM, &name1, &namelen1, OCI_ATTR_NAME, errhp);
                             OCIAttrGet (arg1,
    OCI_DTYPE_PARAM, &arglst2, 0, OCI_ATTR_LIST_ARGUMENTS, errhp);
                             if (arglst2)
                                  OCIAttrGet
    (arglst2, OCI_DTYPE_PARAM, &numargs2, 0, OCI_ATTR_NUM_PARAMS,
    errhp);
                                  for (k = 1; k <=
    numargs2; k++)
         OCIParamGet (arglst2, OCI_DTYPE_PARAM, errhp, &arg2, k);
         OCIAttrGet (arg2, OCI_DTYPE_PARAM, &arglst3, 0,
    OCI_ATTR_LIST_ARGUMENTS, errhp);
         OCIAttrGet (arg1, OCI_DTYPE_PARAM, &name2, &namelen2,
    OCI_ATTR_NAME, errhp);
         //OCIAttrGet (name1, OCI_DTYPE_PARAM, &arglst_type, 0,
    OCI_ATTR_DATA_TYPE, errhp);                         
                                       if
    (arglst3)
         OCIAttrGet (arglst3, OCI_DTYPE_PARAM, &numargs3, 0,
    OCI_ATTR_NUM_PARAMS, errhp);
         for (m = 1; m <= numargs3; m++)
         OCIParamGet (arglst3, OCI_DTYPE_PARAM, errhp, &arg3, m);
         OCIAttrGet (arg3, OCI_DTYPE_PARAM, &name3, &namelen3,
    OCI_ATTR_NAME, errhp);
         }//end for m
                                       }//end
    arglst3
                                  }//end for k
                             }//end arglst2
                        } //end for j
                   }//end arglst1
              }//end for i
         }//end arglst
         //free the describe handle
         OCIHandleFree((dvoid *) dschp, (ub4) OCI_HTYPE_DESCRIBE);
    Thanks a lot.

    The arglist starts from 0th position for packages.
    Try for (i=0; i<=numargs-1;++i).

  • Execute procedure in a package using the caller privileges?

    Is it possible to execute a procedure within a package using the privileges of the caller rather than the privileges of the package owner? So if we have a procedure that does a select, one that does an insert, and another for update and a 4th for delete, then we just want to grant execute to user X on the select procedure in the package. This is a developer request. I think I just need to tell the requestor to copy or move the procedure out of the package and into it's own procedure so that it's safe to run by user X and not grant execute on the package since I don't believe it is possible to specify what procedures in a package are granted execute since that command is a blanket for the whole package right?
    Example - fails due to specifying the proc:
    grant execute on scmemaname.pkgname.procname to usr;
    There's no other command to do that is there?
    Thanks,
    Dave
    Edited by: Gib on Jan 19, 2010 8:42 AM

    AUTHID is at the package level ... not the individual function or procedure.
    Create a second package.

  • Describe (Shift-F4) For Package Body

    Hi Experts,
    Just a quick query if there is an quick way of getting to view the package body from an SQL Worksheet via Shift-F4 or similar ?
    MY_CUSTOM_PACKAGE (Highlight & Shift-F4) gives me the spec, I would like to view the body (preferably have the option of viewing either spec or body/have both displayed in popup window)
    The only way I have found is to use Connection navigator, create a filter on packages with the package name and then open up the top level navigate to the body node and click to open it in another window.
    I am using ebusiness suite with 10,000's of packages in the schema, so a simple open of packages and a manual scroll is not really an option.
    Thanks

    Hi Jim,
    I have used the search however the key point is being able to select an object already in the editor or type it in and then describe and edit it from there. For example, I have a saved SQL which contains an anonymous block calling a packaged procedure that I have written. I have the package right in front of me in the SQL Worksheet, however all I can do with it at the moment is view the package spec...
    In my experience there seems to be two types of development styles out there, those who like to browse thru gui-based navigators to find things, and others who are more editor-centric in their approach (usually people who have been developing since SQL*Plus days or people who are familiar with TOAD). At the moment SQLDev while constantly improving is very much orientate towards the former.
    regards,
    Brenden

  • Help on ORA-06550 & PLS-00363 Error while running a procedure from a packag

    Greeting All,
    I ran the following procedure from a package on a command line in sqlplus:
    SQL> exec QUALITY_ASSURANCE.COPY_SW_RESOURCES(2009,2010,9508);Where '2009' is the old fiscal year, '2010' is the new fiscal year and '9508' is the error code passed from the calling program. But, I received the following error messages:
    ERROR at line 1:
    ORA-06550: line 1, column 53:
    PLS-00363: expression '9508' cannot be used as an assignment target
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    Any thoughts, suggestions and/or advice to resolve these errors.
    Thanks in advance.

    Orchid wrote:
    Justin,
    Thanks for your response and information. Yes, Theoa was correct the 3rd parameter is an OUT variable, and it is a numeric field. The procedure was called by a form as follows:
    QUALITY_ASSURANCE.COPY_SW_RESOURCES(:BLK_CONTROL.FROMFY,:BLK_CONTROL.TOFY,V_ERR);But the form does not work so I am trying to isolate the problem by running the procedure by itself in sqlplus to make sure there is no problem with the procedure.
    Yesterday, I was able to run the procedure in Toad for Oracle to a successful completion by providing the 3 parameters: (2009, 2010, null). Just wonder why I cannot run the same procedure with the same parameters on a command line in sqlplus as follows:
    exec QUALITY_ASSURANCE.COPY_SW_RESOURCES(2009,2010,null);So, if I understand your suggestion correctly, in order to run the procedure with the 3 parameter successfully in sqlplus,
    I have to declare the 3rd parameter in PL/SQL. That is to create a PL/SQL file as suggested and run the file, correct? CORRECT!

  • Calling a stored procedure within a package

    We have a number of packages containing stored procedures. In an existing production application, we used embedded SQL in C programs to call these stored procs
    e.g.
    EXEC SQL EXECUTE
    BEGIN owner.fees_calc.some_fee(:parm1,...);
    END;
    END-EXEC;
    Now, I am trying to use SQLJ to call this same stored proc in the package. However, I am getting a compilation error from sqlj saying that it cannot find a stored procedure or function of that name. It works fine if I use a stored proc that is not in a package.
    So how do I call a stored procedure within a package? Or is this not currently possible with sqlj?
    I am also getting a warning just before the error and I'm wondering if the error is being caused by this:
    Warning: You are using an Oracle JDBC driver, but connecting to a non-Oracle database. SQLJ will perform JDBC-generic SQL checking.
    I am connecting to an Oracle 7.3.3 database using an Oracle 7.3.4 JDBC driver. I also tried using the Oracle 8.0.5 JDBC driver for the same database but I get the same warning message.

    I used the following code to call a stored
    procedure via SQLJ:
    try {
    #sql [iCtx] {
    CALL ibs.cvs_validate.validate_port_id(:IN record_id ,:IN poe_pod_flag,:IN port_id,:OUT error_code,:OUT error_message) };
    where
    "ibs" is the schema
    "cvs_validate" is the package
    "validate_port_id" is the procedure
    The code runs fine, but to get it to compile
    in JDeveloper 2.0, I had to disable the "Check SQL semantics against database schema" option on the Project Properties (SQLJ) property sheet.
    null

  • Calling a procedure from a package or another procedure

    Hi all,
    I am trying to call a couple of procedures defined in a package using the 'call' method without any success.
    i tried to create a third procedure and call the other two procedures from there, still without success. Can some one tell me the right method? also i've been trying to research a lot, but havent found any helpful documentation. where would i look for good help material on PL/SQL?
    Purvi.

    All Oracle's documentation is available online at http://tahiti.oracle.com. In particular, the PL/SQL User's Guide would probably be the most helpful to you.
    "call" is something that is generally used on client applications (ODBC and JDBC based). It is not used when calling stored procedures in PL/SQL. If you have procedures proc1 and proc2, you can call them from a third stored procedure proc3 like this
    CREATE OR REPLACE PROCEDURE proc1
    AS
    BEGIN
      dbms_output.put_line( 'proc1' );
    END;
    CREATE OR REPLACE PROCEDURE proc2
    AS
    BEGIN
      dbms_output.put_line( 'proc2' );
    END;
    CREATE OR REPLACE PROCEDURE proc3
    AS
    BEGIN
      proc1();
      proc2();
    END;If both proc1 and proc2 were in a package called myPkg, and proc3 was a standalone procedure, you would need to modify it to reference the package name
    CREATE OR REPLACE PROCEDURE proc3
    AS
    BEGIN
      myPkg.proc1();
      myPkg.proc2();
    END;Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Using dynamic value in procedure on column

    I want a PL/sql procedure to select the data from the column dynamically into a variable .
    My friend suggested its not possible in PL/sql ,its only possible in sql .
    What i want is when i execute the PL/sql procedure the a_1 must get the value of the data in the table,i do not want to use execute immediate in pl/sql.
    I create a table A
    create table A (a1 number,a2 number,a3 number);
    insert into a values (1,2,3);
    then i create a procedure
    create or replace
    procedure test_a (var IN number)
    as
    a_1 number;
    i number;
    z varchar2(5);
    begin
    if var=1
    then
    i:=1;
    elsif var = 2
    then
    i:=2;
    z:='A2';
    end if;
    SELECT 'a'||i into a_1 from a;
    end;
    Edited by: user536416 on May 13, 2010 4:03 AM

    I prefer reference cursors over execute immediate if I must do dynamic SQL (and have learned not to do it unless necessary - among other things dynamic SQL is hard to debug and maintain).
    The advantages to ref cursors are
    * execute immedate will only retrieve one row, ref cursors as many as you want
    * easier for me to build the query first, then execute it (though you can do this with execute immediate too) for debugging
    You can buiid the query dynamcially but have to be careful to make sure the select list matches the INTO clause on the fetch statements. Although the queries in the example below are hard coded I could have done something like
      v_command_c := 'select '||var1||', '||var2||' from '''||table_name||'''';
      open refcur for v_command_c;To randomize your column selection use something like the above with IF logic and a randomizer, possibly the DBMS_RANDOM package or a time extraction.
    Something like
    SET SCAN OFF
    SET SERVEROUTPUT ON
    DECLARE
      --define composite data types
      --reference cursor type - structure
      TYPE RefCursorType   IS REF CURSOR;
      --collection (index-by table) type - structure
      TYPE TablesTableType IS TABLE OF user_tables.table_name%TYPE
        INDEX BY BINARY_INTEGER;
      --define ref cursors to be used in BEGIN section
      UserTablesCursor RefCursorType;
      UserViewCursor   RefCursorType;
      --define actual index-by tables to be used in BEGIN section
      NamesTable TablesTableType;
      ViewsTable TablesTableType;
      --define internal procedures to be used in this script
      PROCEDURE ListItems(RefCursor IN RefCursorType,
        DataTable IN OUT TablesTableType
        ) IS
        Counter   INTEGER := 1;
        TableName user_tables.table_name%TYPE;
      BEGIN
        FETCH RefCursor INTO DataTable(Counter);
        Counter := Counter + 1;
        WHILE RefCursor%FOUND LOOP
          FETCH RefCursor INTO DataTable(Counter);
          Counter := Counter + 1;
        END LOOP;
      END; --ListItems;
      PROCEDURE WriteItems(DataTable IN TablesTableType) IS
      BEGIN
        FOR i IN 1..DataTable.count LOOP
          dbms_output.put_line(DataTable(i));
        END LOOP;
      END; --WriteItems;
    BEGIN
      OPEN UserTablesCursor FOR
        SELECT table_name
          FROM user_tables;
      ListItems(UserTablesCursor,NamesTable);
      CLOSE UserTablesCursor;
      dbms_output.put_line('user_tables');
      dbms_output.put_line('--------------');
      WriteItems(NamesTable);
      --second defintion & set of calls
      dbms_output.put_Line(CHR(13));
      OPEN UserTablesCursor FOR
        SELECT view_name
          FROM user_views;
      ListItems(UserTablesCursor,ViewsTable);
      CLOSE UserTablesCursor;
      dbms_output.put_line('user_views');
      dbms_output.put_line('--------------');
      WriteItems(ViewsTable);
    END;
    /Edited by: riedelme on May 13, 2010 5:44 AM

  • Display invalid pattern name while calling the procedure inside the package

    Hi ,
    I'am trying to call a package which is having procedure ,from JDBC in which one of the return type is Varray from the procedure.When i'am calling the procedure inside the package
    from java showing invalid name pattern name.Just i'am placing the code snippet for package and calling java through package.
    Package body
    create or replace package body Rewards_Summary_Package as
    PROCEDURE Rewards_Summary_Procedure
    (v_Tot_Earned_Points OUT NUMBER, v_TOT_REDEEMED OUT NUMBER, v_TOT_PTS_EXP OUT NUMBER,
    v_TOT_AVAILABLE OUT NUMBER, v_TIER_NAME OUT VARCHAR2,VA OUT t_varray,V_PR_CON_ID IN VARCHAR2) AS
    v_ACCRUALED_VAL NUMBER := 0;
    v_USED_VAL NUMBER := 0;
    /*v_TOT_ACCRUALED_VAL NUMBER := 0;
    v_TOT_USED_VAL NUMBER := 0;
    V_PR_TIER_ID VARCHAR2(30);
    V_PR_CON_ID VARCHAR2(30);
    V_EXPIRY_DT DATE;
    v_month varchar2(30);
    v_date date;
    v_next_month_date date;
    v_TIER_NAME VARCHAR2(50);
    v_TOT_AVAILABLE NUMBER := 0;
    v_EARNED NUMBER := 0;
    v_TOT_EARNED NUMBER := 0;
    v_TOT_REDEEMED NUMBER := 0;
    v_TOT_EXPIRED NUMBER := 0;
    v_EARNED_TOTAL NUMBER := 0;
    v_TOT_EXPIRED_MONTH NUMBER := 0;
    v_TOT_PTS_EXP NUMBER := 0;
    v_TOT_RDMD_CANCELLED NUMBER :=0;
    v_TOT_EARNED_POINTS NUMBER :=0;*/
    v_FIRST_DT DATE;
    v_LAST_DT DATE;
    v_MEMBER_ID VARCHAR2(30);
    V_EXPIRED_VAL Number;
    v_TOT_PRDPTS_RDMD NUMBER := 0;
    v_TOT_PTS_RDMD NUMBER := 0;
    v_CAN_ACCRUAL_POINTS NUMBER := 0;
    BEGIN
    /*TotalRwdPoints and Tier Name*/
    SELECT TR.NAME,MEM.POINT_TYPE_A_VAL,MEM.ROW_ID INTO v_TIER_NAME,v_TOT_AVAILABLE,v_MEMBER_ID
    FROM SIEBEL.S_LOY_MEMBER MEM, SIEBEL.S_LOY_TIER TR WHERE MEM.PR_DOM_TIER_ID=TR.ROW_ID
    AND MEM.PR_CON_ID=V_PR_CON_ID;
    vTotPrdPtsRdmd
    SELECT NVL(SUM(A.VALUE),0) INTO v_TOT_PRDPTS_RDMD from SIEBEL.S_LOY_RDM_ITM A,SIEBEL.S_LOY_ATTRDEFN B
    WHERE A.MEMBER_ID = v_MEMBER_ID AND A.ATTRB_DEFN_ID = B.ROW_ID AND b.INTERNAL_NAME = 'Point 1 Value' AND A.TYPE_CD='Product'
    AND A.TXN_ID IS NOT NULL;
    vTotPtsRdmd
    SELECT NVL(SUM(A.VALUE),0) INTO v_TOT_PTS_RDMD from SIEBEL.S_LOY_RDM_ITM A,SIEBEL.S_LOY_ATTRDEFN B
    WHERE A.MEMBER_ID = v_MEMBER_ID AND A.ATTRB_DEFN_ID = B.ROW_ID AND b.INTERNAL_NAME = 'Point 1 Value' AND (A.TYPE_CD='Product' or A.TYPE_CD='Transfer')
    AND A.TXN_ID IS NOT NULL;
    vTotRewardPtExp
    SELECT NVL(SUM(A.VALUE),0) INTO v_TOT_PTS_EXP FROM SIEBEL.S_LOY_RDM_ITM A,SIEBEL.S_LOY_ATTRDEFN B
    WHERE A.MEMBER_ID = v_MEMBER_ID AND A.ATTRB_DEFN_ID = B.ROW_ID AND b.INTERNAL_NAME = 'Point 1 Value' AND A.TYPE_CD='Expired'
    AND a.TXN_ID IS NULL;
    vCanAccrualPoints
    SELECT NVL(SUM(A.ACCRUALED_VALUE),0) INTO v_CAN_ACCRUAL_POINTS from SIEBEL.S_LOY_ACRL_ITM A,SIEBEL.S_LOY_ATTRDEFN B
    WHERE A.MEMBER_ID = v_MEMBER_ID AND A.ATTRIB_DEFN_ID = B.ROW_ID AND b.INTERNAL_NAME = 'Point 1 Value' AND A.TYPE_CD='Cancellation';
    v_Tot_Earned_Points := v_TOT_AVAILABLE+v_TOT_PRDPTS_RDMD+v_TOT_PTS_EXP-v_CAN_ACCRUAL_POINTS;
    v_TOT_REDEEMED := v_TOT_PTS_RDMD-v_CAN_ACCRUAL_POINTS;
    DBMS_OUTPUT.PUT_LINE(' Total Earned: '|| v_Tot_Earned_Points || ' Total Redeemed: '|| v_TOT_REDEEMED || ' Total Expired: '|| v_TOT_PTS_EXP
    || ' Balance Points: '|| v_TOT_AVAILABLE || ' Tier Name: '|| v_TIER_NAME);
    select trunc(sysdate,'MONTH') INTO v_FIRST_DT from dual;
    va:= t_varray(Null,Null,Null,Null,Null,Null);
    FOR a in 1 .. 6 LOOP
    select trunc(last_day(v_FIRST_DT)) INTO v_LAST_DT from dual;
    SELECT SUM(AI.ACCRUALED_VALUE),SUM(AI.USED_VALUE) INTO v_ACCRUALED_VAL,v_USED_VAL from SIEBEL.S_LOY_ACRL_ITM AI,SIEBEL.S_LOY_ATTRDEFN A
    WHERE AI.MEMBER_ID = v_MEMBER_ID AND A.ROW_ID = AI.ATTRIB_DEFN_ID AND A.INTERNAL_NAME = 'Point 1 Value'
    AND trunc(AI.EXPIRATION_DT) >= v_FIRST_DT AND trunc(AI.EXPIRATION_DT) <= v_LAST_DT;
    V_EXPIRED_VAL := NVL(v_ACCRUALED_VAL-v_USED_VAL,0);
    va(a):=V_EXPIRED_VAL;
    v_FIRST_DT := add_months(v_FIRST_DT,1);
    End loop;
    END;
    end;
    Package declaration
    create or replace package Rewards_Summary_Package as
    TYPE t_varray IS VARRAY(6) OF NUMBER;
    PROCEDURE Rewards_Summary_Procedure
    (v_Tot_Earned_Points OUT NUMBER, v_TOT_REDEEMED OUT NUMBER, v_TOT_PTS_EXP OUT NUMBER,
    v_TOT_AVAILABLE OUT NUMBER, v_TIER_NAME OUT VARCHAR2,VA OUT t_varray,V_PR_CON_ID IN VARCHAR2);
    end;
    java code
    I had tried using java types and Oracle types
    conn=SiebelServiceDatasource.getConnection(SSBConstants.REWARDS_PROP_LOG_SUFIX);
    // ArrayDescriptor.TYPE_VARRAY
    ocstmt=(OracleCallableStatement)conn.prepareCall(" {call REWARDS_SUMMARY_PACKAGE.REWARDS_SUMMARY_PROCEDURE(?,?,?,?,?,?,?)}");
    //ocstmt=(OracleCallableStatement)conn.prepareCall(" call Test_Array(?,?)");
    ocstmt.registerOutParameter(1,OracleTypes.INTEGER);
    ocstmt.registerOutParameter(2,OracleTypes.INTEGER);//1-616BH
    ocstmt.registerOutParameter(3,OracleTypes.INTEGER);
    ocstmt.registerOutParameter(4,OracleTypes.INTEGER);
    ocstmt.registerOutParameter(5,OracleTypes.VARCHAR);
    ocstmt.registerOutParameter(6,OracleTypes.ARRAY,"SIEBEL.T_VARRAY");
    ocstmt.setString(7,contactSiebelRowId);
    ocstmt.execute();
    Showing the following invalid name pattern SIEBEL.T_VARRAY
    Please help
    Thanks in advance
    Kiran

    create or replace package Rewards_Summary_Package as
        TYPE t_varray IS VARRAY(6) OF NUMBER;
    end;You've declared your type inside the package. You need to declare it as a SQL type, which is not part of a PL/SQL package.

  • Oracle stored procedure in a package

    Hello,
    I'm working on a Web service -> XI -> Oracle scenario.
    In the receiver side I'm using JDBC Adapter to call to stored procedure.
    I have stored procedure in a package.
    For example: package "price_list_pk" and stored procedure "is_pl".
    When I try to enter the stored procedure path to XML tags I need to separate between the package and the stored procedure with dot "." and dot is not allowed in XML tag.
    I want to now if you have answer for this problem
    Have other way to work with stored procedure in packages?
    Elad

    Hey everyone,
    What Elad means is that in the XML structure of JDBC there are 2 places you define the DB\SP name:
    1. Defined in the structure itself as an element name. (DT)
    2. Mapped with a constant to a subelement called TABLE. (MM)
    The MM shouldn't be a problem as a value can get the dot character.
    But, in the DT structure, because you define here a XSD (XML structure) there is a problem naming the element with the dot character being part of the name as this character is not accepted in a XML tagname.
    The right question is if anyone knows of a special XML attribute with which you could define that the element name would contain a dot character? Or else a creative way to call a Stored Procedure inside a Package despite the disabilities above?
    Ben

  • List of procedures in a package

    Hi,
    Iam using oracle 11g.
    is there any option to view list of procedures in a package.
    all_procedures gives me list of procedures defined in package specification.
    But i need list of procedures defined in package body both public and private procedures
    Thanks in advance..
    Edited by: user9080289 on Aug 9, 2010 5:00 AM
    Edited by: user9080289 on Aug 9, 2010 5:00 AM

    try this
    SELECT v.owner,
           (CASE V.type
            WHEN 'FUNCTION'  THEN NULL
            WHEN 'PROCEDURE' THEN NULL
            ELSE v.name
            END
           )PACKAGE_NAME ,
            UPPER(
            SUBSTR
            TRANSLATE(
            LTRIM(REPLACE(SUBSTR(ltrim(v.text),LENGTH('PROCEDURE')+1),'"',''),' '),
            '+++'
            ),---TEXT TO BE SEARCH
            1,---STARTING POSITION
            INSTR(
            TRANSLATE(
            LTRIM(REPLACE(SUBSTR(ltrim(v.text),LENGTH('PROCEDURE')+1),'"',''),' '),
            '+++'
            ||'+'
            '+'
            )-1 ---lENGTH
            )OBJECT_NAME
            TRIM(SUBSTR(ltrim(v.text),1,LENGTH('PROCEDURE')))"TYPE"
    FROM dba_source v
    WHERE (TRIM(ltrim(v.text)) LIKE ('FUNCTION%') OR TRIM(ltrim(v.text)) LIKE ('PROCEDURE%')) AND
          v.owner IN (your schema) AND
          v.type IN ('PACKAGE BODY')
    ORDER BY V.OWNER,V.name,v.text;note:
    you may not need the Translate function here, but in my place the spacing of the procedure is a little bit messy.
    maybe there are other better ways than this
    hope this help
    Edited by: HGDBA on Aug 9, 2010 8:09 AM

  • How can i find start line of any functions or procedures stored in package body?

    hi
    how can i find start line of any functions or procedures stored in package body?
    is there any way to write a query from for example user_source?
    thanks

    how can i find start line of any functions or procedures stored in package body?
    Why? What will you do differently if a procedure starts on line 173 instead of line 254?
    Tell us what PROBLEM you are trying to solve so we can help you find the best way to solve it.
    If you use PL_SCOPE that info is available in the *_IDENTIFIERS views. See 'Using PL/Scope in the Advanced Dev Doc
    http://docs.oracle.com/cd/B28359_01/appdev.111/b28424/adfns_plscope.htm
    Try this simple sample code. The query is modified from that doc sample:
    -- tell the compiler to collect the info
    ALTER SESSION SET PLSCOPE_SETTINGS='IDENTIFIERS:ALL';
    -- recompile the package
    CREATE OR REPLACE package SCOTT.pack1 as
    PROCEDURE proc1;
    PROCEDURE proc2;
    END;
    CREATE OR REPLACE package BODY SCOTT.pack1 as
    PROCEDURE proc1 IS
    BEGIN
      NULL;
    END;
    PROCEDURE proc2 IS
    BEGIN
      proc1;
    END;
    PROCEDURE proc3 IS
    BEGIN
      proc1;
      proc2;
    END;
    END;
    -- query the info for the package spec
    WITH v AS (
      SELECT    Line,
                Col,
                INITCAP(NAME) Name,
                LOWER(TYPE)   Type,
                LOWER(USAGE)  Usage,
                USAGE_ID,
                USAGE_CONTEXT_ID
        FROM USER_IDENTIFIERS
          WHERE Object_Name = 'PACK1'
            AND Object_Type = 'PACKAGE'
    SELECT LINE, RPAD(LPAD(' ', 2*(Level-1)) ||
                     Name, 20, '.')||' '||
                     RPAD(Type, 20)||
                     RPAD(Usage, 20)
                     IDENTIFIER_USAGE_CONTEXTS
      FROM v
      START WITH USAGE_CONTEXT_ID = 0
      CONNECT BY PRIOR USAGE_ID = USAGE_CONTEXT_ID
      ORDER SIBLINGS BY Line, Col
    LINE,IDENTIFIER_USAGE_CONTEXTS
    1,Pack1............... package             declaration        
    2,  Proc1............. procedure           declaration        
    3,  Proc2............. procedure           declaration        
    -- query the info for the package body - change 'PACKAGE' to 'PACKAGE BODY' in the query above
    LINE,IDENTIFIER_USAGE_CONTEXTS
    1,Pack1............... package             definition         
    2,  Proc1............. procedure           definition         
    6,  Proc2............. procedure           definition         
    8,    Proc1........... procedure           call               
    10,  Proc3............. procedure           declaration        
    10,    Proc3........... procedure           definition         
    12,      Proc1......... procedure           call               
    13,      Proc2......... procedure           call               

  • How to list dependencies of stored procedure in a package in oracle

    hi gurus,
    can any body help me to solve the below issue?
    how to list dependencies of stored procedure in a package in oracle?
    advanced thanks...

    It sounds like you're going to have trouble because you're trying to track dependencies at a more fine-grained level than Oracle does (at least prior to 11g, which I know does finer-grained dependency tracking for columns, so there may be something that would help you there).
    In Oracle, the entity is the package body. The procedure within the package does not have dependencies and does not depend on anything, it is part of the package body, which does have dependencies. You can see what tables are used by the package body via DBA_DEPENDENCIES. But if you're trying to track the dependencies for a particular procedure in a package, you'd either have to manually examine the code or you'd have to write your own PL/SQL parser.
    Justin

  • Query for getting all function and procedure inside the packages

    hi All
    Please provide me Query for getting all function and procedure inside the packages
    thanks

    As Todd said, you can use user_arguments data dictionary or you can join user_objects and user_procedures like below to get the name of the packaged function and procedure names.
    If you are looking for the packaged procedures and functions source then use user_source data dictionary
    select a.object_name,a.procedure_name from user_procedures a,
                  user_objects b
    where a.object_name is not null
    and a.procedure_name is not null
    and b.object_type='PACKAGE'        
    and a.object_name=b.object_name

Maybe you are looking for

  • Footer not staying put

    I am not an expert at CSS, and I am sure that I have made a mess of things. My footer is as big as a browser window, but not as big as the webpage. I hope that makes sense? If I have a small little window open and scroll to the right to see the entir

  • I cannot complete the registration for an iTunes account since I do not own a credit card, nor does the rest of my family. HELP!

    I came upon registering for an iTunes account but the only payment options it gives me require a credit card. Our family does not own a single credit card.... What do I do now? Please help!!!

  • Planned delivery time field in sale order

    Dear All, During creation of  STO at item level under delivery TAB "planned delivery time" field is showing with edit mode, I want to activate this field for sale order creation / change also. Plz advice how I can do this. regards, sps.

  • MM Inbound Delivery and tcodes.

    Hi gurus, I am a abaper working in MM Module and came across this post  from bijay kumar: The Inbound process comprises all the steps of an external procurement process that occur when the goods are received. The process is: Purchase order --> Goods

  • How do I successfully play Windows Media (asx) files on a Mac?

    I have access to live streaming of foreign TV programming, but only with WM asx files. I can play them perfectly with Windows Media Player on a PC, but no luck with WMPlayer 9.0 on my Mac. Does anyone have a suggestion as to how I can play these stre