Calling the package dynamically inside a procedure

HI
i have table which contains contains package name, procedurename,input parameters and output parameters as columns like below.
Table name is PKG_META_DATA.
package_name Procedure_name input parameters output parameters
pkg1 prc1 i_location,i_type o_date
pkg2 prc3 i_location o_date ,o_prev_date
Note:Input parameters and output parameters will vary according to package
Now i need to write a procedure which calls package dynamically and display the output values.
i have tried it in this way but it it is not working.please help
declare
l_text varchar2(1000);
cursor c1 is select package_name,Procedure_name,input parameters,output parameters from pkg_meta_date;
begin
for cur in c1 loop
execute immediate 'begin '||package_name||'.'||Procedure_name||'('||input parameters ||output parameters||');'
--display output values from a package
dbms_output.put_line( o_date );
dbms_output.put_line( o_prev_date );
end loop;
end;

user12057782 wrote:
Now i need to write a procedure which calls package dynamically and display the output values.Why do such a silly and stupid thing? Do you have technical justification for wanting to call code dynamically?
And if you reallly and truly need to use dynamic PL/SQL calls, then using bind variables is mandatory. Unless you want to fragment and trash the shared pool and waste a lot of CPU by burning it on hard parsing.
This also means that execute immediate is the wrong choice. (it does not support dynamic binding)
And if I foam a bit at the mouth with this response - simply that I'm getting utterly frustrated seeing yet again dynamic SQL being (ab)used, without the foggiest notion of how to do so correctly, and with complete ignorance of the repercussions on security and performance.
Dynamic coding is NOT the best thing since slice bread. It was never even a consideration as a being better choice.
What it is, is wrong - 99% of the time. Wrong ito design. Wrong for security. Wrong for performance. Wrong for flexibility.

Similar Messages

  • Calling the packager as part of the automated build process

    Hi,
    Is it possible to call the iPhone packager via command line or ANT script? We are developing a pure ActionScript application, and as part of the build process for this app, we'd like to call the packager to build the IPA file.
    Is this possible?
    Stephen

    Is possible.
    This is a piece from my ant build the variables must be configured properly
        <target name="test_package_iphone" depends="-chkName, -iPhonePWD" description="packageApp">
            <apply executable="${PFI_BAT}" parallel="true" dir="${DEBUG_DIR}" relative="true">
                <arg value="-package"/>
                <arg value="-target"/>
                <arg value="ipa-test"/>
                <arg value="-provisioning-profile"/>
                <arg value="${IPHONE_PROVISIONING}"/>
                <arg value="-storetype"/>
                <arg value="pkcs12"/>
                <arg value="-keystore"/>
                <arg value="${IPHONE_KEYSTORE}"/>
                <arg value="-storepass"/>
                <arg value="${IPHONE_PASSWORD}"/>
                <arg value="${app.name}.ipa"/>
                <arg value="${app.name}-app.xml"/>
                <arg value="${app.name}.swf"/>
                <arg value="-C"/>
                <arg value="${ASSETS_DIR}"/>
                <srcfile/>
                <fileset dir="${ASSETS_DIR}"/>
            </apply>
        </target>

  • Calling a package function inside a sql

    Hi friends!!!
    First of all happy Christmas! And them please help! :)
    We have a query calling a package function:
    SELECT * FROM DW025H WHERE DW025H_NR=MPPCI.ENCR ('0000000000000000');There is a primary key just with one column DW025H_NR and the problem is that is not accessing by INDEX UNIQUE SCAN,
    it's accessing by TABLE ACCESS FULL.
    May be the problem is that we are calling a procedure inside the query?
    I have been able to run that query accessing by primary key from my computer but a workmate hasn't!
    We both are connecting the same data base 10.2.0.4 and using Oracle SQL Developer!
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 5343K| 1406M| 15670 (7)| 00:02:43 |
    |* 1 | VIEW | DW025H | 5343K| 1406M| 15670 (7)| 00:02:43 |
    |* 2 | FILTER | | | | | |
    | 3 | TABLE ACCESS FULL| DW025H | 5343K| 1406M| 15670 (7)| 00:02:43 |
    Predicate Information (identified by operation id):
    1 - filter("DW025H_NR"="MPPCI"."ENCRIPTAPAN"('0000000000000000'))
    2 - filter(CASE "OPS$SISINFO"."IS_USER_DNI"() WHEN 1 THEN
    SYS_AUDIT('OPS$SISINFO','DW025H','CMINFOGR001',3) ELSE NULL END IS
    NULL)
    The correct path would be:
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 1 | 276 | 3 (0)| 00:00:01 |
    |* 1 | FILTER | | | | | |
    | 2 | TABLE ACCESS BY INDEX ROWID| DW025H | 1 | 276 | 3 (0)| 00:00:01 |
    |* 3 | INDEX UNIQUE SCAN | PK_DW025H | 1 | | 2 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    1 - filter(CASE "OPS$SISINFO"."IS_USER_DNI"() WHEN 1 THEN
    SYS_AUDIT('OPS$SISINFO','DW025H ','CMINFOGR001',3) ELSE NULL END IS NULL)
    3 - access("DW025H_NR"="MPPCI"."ENCR"('0000000000000000'))
    Please any ideas!?!?!
    Thanks a lot!
    José
    Edited by: jamv on Dec 20, 2011 10:50 AM

    Hello
    Have a read of this and try to pull together the information in it and post it up here. That will help immensely with getting to the root of your problem...
    HOW TO: Post a SQL statement tuning request - template posting
    In the mean time:
    From the execution plan you have extra predicates that aren't present in the query you supplied, so that's either not the SQL or you have something like VPD switched on.
    Anyway, there could be lots of reasons for the difference in execution plan. Sorry if this is very basic and possibly patronising question but it's always worth checking the basics I think - are you both definitely connecting to the same database? If so, have a look in v$sqlarea for this SQL statement and find the SQL_ID, use this to query v$sql and look at the child_number column.
    select
        sql_id
    from
        v$sqlarea
    where
        sql_text like '%SELECT * FROM DW025H WHERE DW025H_NR=MPPCI.ENCR%(''0000000000000000'')%'
    and
        sql_text not like '%v$sqlarea%'
    select child_number from v$sql where sql_id='<enter the sql id returned by the query above>'as an example...
    XXXX> select /* my sql statement*/ rownum id from dual;
            ID
             1
    1 row selected.
    Elapsed: 00:00:00.10
    XXXX> select sql_id from v$sqlarea where sql_text like '%my sql statement%'
    and sql_text not like '%v$sqlarea%';
    SQL_ID
    a6ss4v79udz6g
    1 row selected.
    Elapsed: 00:00:03.56
    XXXX> select child_number from v$sql where sql_id='a6ss4v79udz6g'
      2  /
    CHILD_NUMBER
               0
    1 row selected.   If you have more than one row in v$sql there could be differences in the optimiser environment. The supplied like shows you how to gather the information that should help find what the differences are if any.
    Also as a side note if you're calling PL/SQL functions from SQL, you can take advantage of subquery caching to help reduce the number of calls (depending on your version). As it stands, your function is most likely going to be called for every row - when there is only a single row returned, that's not necessarily a problem but for multiple rows, the overhead can quickly grow. If there's no way to get rid of the function call, select the function from dual instead i.e.
    SELECT * FROM DW025H WHERE DW025H_NR= (SELECT MPPCI.ENCR%('0000000000000000') FROM dual);This also (as I learnt a couple of weeks ago) works when you're using columns in the table your selecting from as parameters to the function.
    HTH
    David

  • Getting error code 1 when calling SSIS package from a stored procedure (SQL Server 2008 R2)

    Hello,
    I am trying to execute a SSIS package from SQL Server 2008 R2 stored procedure but getting error code 1 (as per my knowledge, error code description is as below:
    0 The package executed successfully.
    1 The package failed.
    3 The package was canceled by the user.
    4 The utility was unable to locate the requested package. The package could not be found.
    5 The utility was unable to load the requested package. The package could not be loaded.
    6 The utility encountered an internal error of syntactic or semantic errors in the command line.
    Details:
    I have a stored procedure named "Execute_SSIS_Package" (see below sp) which executes 'Import_EMS_Response' SSIS package (when I execute this package directly from SQL Server BID it works fine it means package itself is correct) and calling
    it from SQL as:- EXEC Execute_SSIS_Package 'Import_EMS_Response'.
    Here I receives error code 1.
    Can anyone help me to resolve this issue please?
    Thanks in advance!
    CREATE PROCEDURE [dbo].[Execute_SSIS_Package]
     @strPackage nvarchar(100)
    AS
    BEGIN
     -- SET NOCOUNT ON added to prevent extra result sets from
     -- interfering with SELECT statements.
     SET NOCOUNT ON;
     DECLARE @cmd VARCHAR(8000)
     DECLARE @Result int
     DECLARE @Environment VARCHAR(100)
        SELECT @Environment = Waarde
     FROM  Sys_Settings
     WHERE Optie = 'Omgeving'
     --print @Environment
     SET @strPackage = '"\W2250_NGSQLSERVER\BVT\' + @Environment + '\' + @strPackage + '"'
     SET @cmd = 'dtexec /SQL ' + @strPackage +  ' /SERVER "w2250\NGSQLSERVER"  /Decrypt "BVT_SSIS" /CHECKPOINTING OFF /REPORTING E'
     --print @cmd
     EXECUTE @Result = master..xp_cmdshell @cmd, NO_OUTPUT
     --print @Result
    END

    It has something to do with the security.
    E.g. cmdshell is not enabled or the caller has not rights over the package.
    There could be a syntax error, too.
    I suggest you make the package runnable off a SQL Agent job then trigger the job from the stored proc with
    sp_start_job <job name>
    Arthur
    MyBlog
    Twitter

  • Calling the package having cursor type and record type variables

    Hi ,
    I tried the following pacakge ,which is similar to my requriement ,the package got created succesfully, while calling it is giving me the error, Wrong no.of arguments
    CREATE OR REPLACE PACKAGE Pkg_test1
    IS
      ----- Record Variable ----
      TYPE rec_job IS RECORD
       ( job varchar2(50),
         ename varchar2(50),
         sal number
      TYPE typ_job IS TABLE OF rec_job;
      -- cursor declaration
      cursor emp_cur is select empno from  emp;
      TYPE emp_ttyp IS TABLE OF emp_cur%ROWTYPE INDEX BY PLS_INTEGER;
      ---- Procedure Declaration ----
    PROCEDURE proc_job ( p_cur IN   emp_ttyp,
                         o_Rat     OUT  typ_job );
    END Pkg_test1;
    CREATE OR REPLACE PACKAGE BODY Pkg_test1
    IS
    PROCEDURE proc_job ( p_cur IN   emp_ttyp, o_Rat     OUT  typ_job )
      IS
        -- Declare collection variable
        l_typ_job typ_job;
    BEGIN
       for i  in 1..p_cur.count loop
        select job,ename,sal bulk collect into l_typ_job
          from emp
          where empno=p_cur(i).empno ;
    o_Rat:= l_typ_job;
    end loop;
    --Output
    for i in 1..o_rat.count loop
    DBMS_OUTPUT.PUT_LINE ( 'Output :'||o_rat(i).job||','||o_rat(i).ename||','||o_rat(i).sal );
      end loop;
    EXCEPTION
      WHEN OTHERS THEN
           DBMS_OUTPUT.put_line('Procedure proc_job  - '|| SQLCODE|| '-'|| SQLERRM);
    END proc_job;
      end pkg_test1;
    /The package is created without errors
    But while calling it is giving me the errors
    DECLARE
      P_CUR PKG_TEST1.emp_ttyp;
      O_RAT PKG_TEST1.rec_job;
    BEGIN
      PKG_TEST1.PROC_JOB ( P_CUR, O_RAT );
      COMMIT;
    END; Error is ::
    PLS-00306: wrong number or types of arguments in call to 'PROC_JOB'Could you hint me how to overcome this error..
    Thank you..
    Edited by: Smile on May 9, 2012 7:27 AM

    # If p_cur input parameter is uninitialized and NULL then you cannot use any nested table function like count, first, last. Hence call to "p_cur.count " failes with error - "ORA-06531: Reference to uninitialized collection"
    # Always check uninitialized collection using "IS NULL or IS NOT NULL" condition
    # There is one more logic error:
    for i  in 1..p_cur.count loop
        select job,ename,sal bulk collect into l_typ_job
          from emp
          where empno= SELECT column_value FROM (p_cur); (i).empno ;
       o_Rat:= l_typ_job;# You Iterate through all employees inp_cur but the o_Rat will contain only employee details for last employee in the p_cur table. You must use statement like "o_Rat := o_Rat MULTISET UNION l_typ_job;" to append the values into existing collection
    Your package should look like:
    CREATE OR REPLACE PACKAGE pkg_test1 IS
       ----- Record Variable ----
       TYPE rec_job IS RECORD(
          job   VARCHAR2(50),
          ename VARCHAR2(50),
          sal   NUMBER);
       TYPE typ_job IS TABLE OF rec_job;
       -- cursor declaration
       CURSOR emp_cur IS
          SELECT empno FROM emp;
       TYPE emp_ttyp IS TABLE OF emp_cur%ROWTYPE INDEX BY PLS_INTEGER;
       ---- Procedure Declaration ----
       PROCEDURE proc_job(p_cur IN emp_ttyp, o_rat OUT typ_job);
    END pkg_test1;
    CREATE OR REPLACE PACKAGE BODY pkg_test1 IS
    PROCEDURE proc_job(p_cur IN emp_ttyp, o_rat OUT typ_job) IS
    -- Declare collection variable
    l_typ_job typ_job;
    BEGIN
    IF p_cur IS NULL THEN
       dbms_output.put_line('No employees as p_cur is NULL');
    END IF;
    IF p_cur IS NOT NULL THEN
      FOR i IN 1 .. p_cur.count LOOP
        SELECT job, ename, sal BULK COLLECT INTO l_typ_job
        FROM emp
        WHERE empno = p_cur(i).empno;
        o_rat := o_rat MULTISET UNION l_typ_job;
      END LOOP;
      --Output
      FOR i IN 1 .. o_rat.count LOOP
        dbms_output.put_line('Output :' || o_rat(i).job || ',' || o_rat(i).ename || ',' || o_rat(i).sal);
      END LOOP;
    END IF;
    EXCEPTION
    WHEN OTHERS THEN
       dbms_output.put_line('Procedure proc_job  - ' || SQLCODE || '-' || SQLERRM);
    END proc_job;
    END pkg_test1;
    {code}
    Edited by: Himanshu Binjola on May 9, 2012 3:40 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Problem in package run inside stored procedure

    i have ssis package to import data from excel to database.
    package is running correctly inside BIDS.
    but when i run package under stored procedure it is giving error :
    Error:   Code: 0xC0014023
       Source: loop sheets in excel
       Description: The GetEnumerator method of the ForEach Enumerator has failed with error 0x80040E21 "(null)". This occurs when the ForEach Enumerator cannot enumerate.

    Hi BI_DEV_19,
    Does the package connects with network resources? If so, try set the job step to run under a proxy account that is created based on a domain account. In BIDS, the package runs under the Windows account that you log onto the operating system.
    The error message “The GetEnumerator method of the ForEach Enumerator has failed with error 0x80040E21” may occur because the ADODB.dll file is corrupted or missing.  You can check whether the ADODB.dll exists in the following folder:
    C:\program files (x86)\Microsoft.NET\Primary Interop Assemblies
    In this situation, you can back up the existing ADODB.dll file, and copy one from another machine to this server.
    Regards,
    Mike Yin
    TechNet Community Support

  • How to get the package name of a procedure used in a process flow activity

    Hi all. I'm on OWB 11.2.0.2.0.
    When I used a packaged procedure or function in a mapping operator, I can find out the package.program_unit name by getting the operator's FUNCTION_NAME property. For example,
    OMBRETRIEVE MAPPING '$mapName' OPERATOR '$operName' GET PROPERTIES (FUNCTION_NAME)
    But when the same is used in a process flow activity, I can't find a property name that will give me the same information. I can get the BOUND_NAME, it does not tell me the package name. It must be stored in the activity properties because when you pull up the Synchronize dialog for the activity, it knows the package name.
    Is there a way to get this via an OMBRETRIEVE?
    Thanks.

    ANA, this is exactly what I needed. Thank you so much. I saw REFs also in the OMBRETRIEVE MAPPING/OPERATOR syntax, but went cross-eyed trying to figure out if I could use the same there. The closest I found was GET BOUND_OBJECT.
    Thanks again!

  • Calling the copy contructor inside a method.

    Hello everyone, Ive got a pretty annoying delima right now. Im trying to write a method that uses the copy contructor inside it and it is simply put, just not working.
    So how do you do this?
    Example I have a copy contructor for a Dll that makes a new copy of a Dll. Now I want to write a method that when its called on a Dll object and given a Dll parameter as input it makes a copy of the input and saves it into the calling Dll object.
    public void DLinkedList(DLinkedList theOriginal)  {
    code
    public void methodWithCopyContructorInside(DLinkedList list) {
    DLinkedList newList = new DLinkedList(list);
    ????????? This is what I would consider to work but since im here you can guess its not.
    Any suggestions, tips, comments would be most appreciated. Thank you.Message was edited by:
    venture

    Here is the code for the methods in question. I only didnt post all of it becuase it is alot of stuff and wasnt sure if anyone had the time and patience to read it. Sorry about that.
    This is the Copy constructor.
    public LinkedList( LinkedList theOriginal ) {
             if( theOriginal == this )
                 ;// do nothing
                  else {
                 // old contents is detached. Deleted by garbage collector.
                      makeEmpty();
                      // Thread the original list inserting all the values found
                      // into the copy. This code is short but inefficient.
                      theOriginal.toHeadNode();
                      while( theOriginal.toNextNode() ) {
                     int coe = theOriginal.getCurrentCoefficient();
              int exp = theOriginal.getCurrentExponent();
                          insertInAscendingList(coe, exp);       
                             //insertInAscendingList( value );
    This is the add method which is supposed to use the copy constructor inside it. Obvisouly from the name of my post you can conclude that this code is incorrect. But to me it seems correct. thus my dilemma.
    public void add(LinkedList b) {
      LinkedList a = new LinkedList(b);
    Here is the outputList method.
    public void outputList()
        toHeadNode();
        while( toNextNode() ) // returns false if back at head
            System.out.print( curr.item + " " );
        System.out.println();
    Now here is the driver program that uses these methods and constructors.
    public static void main(String[] args)
        LinkedList a,b;
        a = new LinkedList();
        b = new LinkedList(a);
        b.outputList();  //This works
        //Now if I call the copy constructor everything works fine. A copy is made and method outputList() will print everything out perfect. But!!, Now if I use the add() method
       b.add(a);
       b.outputList(); //This doesnt work
    im not sure what is being stored into b and outputList() returns nothing. A system.out.println() on b.add(a); returns LinkedList@d9f9c3 Message was edited by:
    venture

  • How to get the JSP Name calling the Tag Library inside the Tag Library

    Hi guys,
    I have defined a Tag Library PenStart:
    import javax.servlet.jsp.tagext.*;
    public class PenStart extends TagSupport
      public int doStartTag()
        return EVAL_BODY_INCLUDE;       
      public int doEndTag()
        return EVAL_PAGE;
    }I have also defined the pentags.tld:
    <taglib xmlns="http://java.sun.com/xml/ns/j2ee"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-jsptaglibrary_2_0.xsd"
              version="2.0">
         <description>My Tag Library</description>
         <tlib-version>1.0</tlib-version>
         <short-name>pentags</short-name>
         <tag>
              <name>penstart</name>
              <tag-class>com.srh.tag.PenStart</tag-class>
              <body-content>empty</body-content>
         </tag>
    </taglib>I am calling the tag library in my JSPs:
    <%@ taglib uri="WEB-INF/pentags.tld" prefix="pen"%>
    <pen:penstart/>Now in the doStartTag() I want to know the JSP which is using the tag. How can I do that?
    Thanks

    pageContext.getRequest().getRequestURI()

  • How to call the url page inside the procedure.

    Hi,
    I am not exposure in plsql.
    I am getting some problem in utl_http link.
    I create a one procedure. The procedure was successfully compiled. But the url page doesnt open..
    I attached the procedure,
    create or replace procedure p(mob number)
    IS
    l_page long;
    l_url varchar2(25000 char) ;
    begin
    null;
    l_page := utl_http.request( 'http://www.yahoo.com');
    end;
    please tell me the solution for this problem..
    I am waiting for ur response.
    Thanks,
    Sasi.

    this is a duplicate thread:
    how to open the web page in pl/sql
    the OP doesn't seem to understand the difference between a web browser and a programming language....... I can't say I've ever had to explain the difference before...
    let's just say.... butterflies are not in any way similar to electric shavers..

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

  • How to call the stored procedure in side the package... ?

    Hi
    I have one package i am new to PL/SQL. I want to execute the package and procedure.
    CREATE OR REPLACE PACKAGE BODY Employee_pkg
    AS
    PROCEDURE GetEmployeeName(i_empno IN NUMBER,
    o_ename OUT VARCHAR2)
    IS
    BEGIN
    SELECT ename
    INTO o_ename
    FROM emp
    WHERE empno = i_empno;
    END GetEmployeeName;
    END Employee_pkg;
    Please tell me how to execute the package. and inside procedure
    Thanks

    SQL> create package employee_pkg
      2  as
      3    procedure getemployeename(i_empno in number, o_ename out varchar2);
      4  end employee_pkg;
      5  /
    Package is aangemaakt.
    SQL> CREATE OR REPLACE PACKAGE BODY Employee_pkg
      2  AS
      3  PROCEDURE GetEmployeeName(i_empno IN NUMBER,
      4  o_ename OUT VARCHAR2)
      5  IS
      6  BEGIN
      7  SELECT ename
      8  INTO o_ename
      9  FROM emp
    10  WHERE empno = i_empno;
    11  END GetEmployeeName;
    12
    13
    14  END Employee_pkg;
    15  /
    Package-body is aangemaakt.
    SQL> var P_ENAME varchar2(30)
    SQL> set autoprint on
    SQL> exec employee_pkg.getemployeename(7839,:P_ENAME)
    PL/SQL-procedure is geslaagd.
    P_ENAME
    KINGRegards,
    Rob.

  • How to pass the arguments dynamically to a Oracle procedure.

    Hi all..
    How to pass the arguments dynamically to a procedure.
    Thanks in Advance.

    I have a concurremt program which has 5 parameters right now. The user can add more parameters from front end as per their requirement.
    So that time.. the 6th parameter has to add to my procedure dynamically.
    Thanks.

  • Calling the procedure from URL is not working

    Hi Experts,
    We are in the process of 11i to R12 upgrade of oracle EBS system.
    In 11i they have done some personalization in the form which will trigger a URL and a notfication will open in the browser.
    11i url
    HTTPS://abc.xyz.t.COM:8070/PLS/abc/XXM_PO_NOTIFICATION_PREVIEW.SHOW?P_PO_HEADER_ID=1711&p_type=PO
    r12 url
    HTTPS://abcr12.xyz.t.COM:8070/PLS/abcr12/XXM_PO_NOTIFICATION_PREVIEW.SHOW?P_PO_HEADER_ID=1711&p_type=PO
    The URL is calling the function XXM_PO_NOTIFICATION_PREVIEW.SHOW by passing the parameters and it is working fine in 11i.
    In r12 it is constructing the correct URL but when the page opens it is saying page not found.
    My question is when we pass call the package in browser URL..does it  executes?
    We have put some debug message in the package but it is not getting pritntig.
    Many Thanks
    Bharat

    Page not found (404) is a generic error from the web server. It simply says something went wrong when it serviced that URL from the browser - not what exactly went wrong.
    You need to look in the error log of the Apache server for the details.
    Assuming a standard OHS (Oracle HTTP Server) install. The URL contains a DAD (Database Access Descriptor) - in your case it is abcr12.  This DAD will be defined in the Apache config file called dads.conf in the mod_plsql directory.
    Part of the DAD definition will be an Oracle username, password, and Oracle connection string (typically TNSFormat).
    The error you see on the browser side is often due to this DAD connection and authentication details failing. E.g. Oracle schema is locked. Oracle password is wrong. TNS connection string requests a non-existing service from the Oracle Listener. Etc.
    But it would make sense to first confirm that this is indeed a connectivity error, via the Apache error log.

  • Call the Function against a select query in 500 procedures...

    Hello Gurus,
    I have a scenario, where i had made one function(UDF Function) to calculate something and in every procedure i call that function and calculate my requirement.
    Yesterday, i made a select query using reg exp for the same calculation..
    So my question is, what should be the proper approach..
    I need to implement this on 500 procedures...
    And the UDF function is
    CREATE OR REPLACE FUNCTION "UDF_TEXTSPLIT" (
    p_list VARCHAR2,
    p_del VARCHAR2 := ','
    ) RETURN split_tbl pipelined
    IS
    l_idx PLS_INTEGER;
    l_list VARCHAR2(7999) ;
    l_value VARCHAR2(7999);
    BEGIN
    l_list := p_list;
    LOOP
    l_idx := INSTR(l_list,p_del);
    IF l_idx > 0 THEN
    pipe ROW(SUBSTR(l_list,1,l_idx-1));
    l_list := SUBSTR(l_list,l_idx+LENGTH(p_del));
    ELSE
    pipe ROW(l_list);
    EXIT;
    END IF;
    END LOOP;
    RETURN;
    END Udf_Textsplit;
    I have made this query:
    SELECT a.b,z. b1 FROM
    (SELECT ROWNUM d,REGEXP_SUBSTR(str1, '[^> ]+', 1, LEVEL) b
    FROM (SELECT 'xxx>zzz>gg' str1 FROM dual)
    CONNECT BY REGEXP_SUBSTR(str1, '[^> ]+', 1, LEVEL) IS NOT NULL)a,
    (SELECT ROWNUM d,REGEXP_SUBSTR(str1, '[^> ]+', 1, LEVEL) b1
    FROM (SELECT '100>500>20' str1 FROM dual)
    CONNECT BY REGEXP_SUBSTR(str1, '[^> ]+', 1, LEVEL) IS NOT NULL)z
    WHERE a.d=z.d
    Do i use the same select query in all 500 procedures or call the (UDF Function) in every procedure..
    So which will be faster...
    Your approach would be very much appreciated...
    Thanks,
    Haraprasad...

    Hmm, do I edit 500 procedures to replace a function call with a SQL statement, or edit 1 function to use a sql statement instead of the current algorithm?
    This is why we use code modules that do one thing and do it well. As long as the new version of the function takes the same arguments and returns the same results as the old, then the callers will never know that the way the function works has changed.
    Whenther you put the select statement in 500 procedures, or 1 function, there will still be a context switch every time you use it. The tiny additional overhead of calling a function before the context switch would be unnoticeable.
    John

Maybe you are looking for

  • Installation CS4 Master Collection (Trial): Photoshop doesn't start

    After installing the following products from the CS4 Master Collections DVD (as 30 days trial versions): - Acrobat 9 - InDesign - Illustrator - Photoshop and everything (what is possible) else UNCHECKED I get the following error at the end of the ins

  • Advance payment in PO

    Dear all, Could any body say,is there any provision to mention Advance payment condition in Purchase Order.Please advise at the earliest possible.For suitbable answer points would be assigned. Regards, NSB

  • Active tab in the tabstrip..

    hi, i created a screen with a tabstrip and 2 tabs. code is generated automatically. I created two table controls, one for each of the subscreens for the tabs. following code was generated: MODULE BDATA_ACTIVE_TAB_SET. MODULE BDATA_ACTIVE_TAB_SET OUTP

  • How i know which software is used in my mac

    how i can use c programme in my macbook... plzzz helppp me

  • Good Issue date in the Sales order should 1 day difference from the MBDAT

    For the particular customer, i want to have difference of 1 day in between the material availability date & good issue date in the schedule line. As per standard i can't made any changes in route and shipping point. Suppose material availability date