Calling a Procedure inside a Function

How to call procedure within the function. please help

I called the procedure as u said but it is firing.. please help me out.. here is the code.
This code is to generate the SEquence ids.
*********** Procedure ***************
create or replace procedure ExecImmd
is
Begin
     EXECUTE IMMEDIATE 'DROP SEQUENCE emplseqid';
     EXECUTE IMMEDIATE 'CREATE SEQUENCE emplseqid START WITH 1001 INCREMENT BY 1';
END;
CREATE OR REPLACE FUNCTION GenCustId RETURN VARCHAR2
IS
VEMPID VARCHAR2(6);
ISEQID NUMBER(5);
P1 VARCHAR2(10);
P2 VARCHAR2(10);
BIND2 VARCHAR2(10);
BEGIN
     SELECT MAX(SUBSTR(EMPID,1,2)) INTO P1 FROM EMPL;     
     SELECT EMPLSEQID.NEXTVAL INTO ISEQID FROM DUAL;
     IF ASCII(SUBSTR(P1,2,1)) < ASCII('Z') THEN
          IF ISEQID <= 9999 THEN
          bind2 := SUBSTR(P1,1,2) || ISEQID;
          ELSE
          /* here i am calling a procedure.
          ExecImmd();
          SELECT EMPLSEQID.NEXTVAL INTO ISEQID FROM DUAL;
          bind2 := SUBSTR(P1,1,1) || CHR(ASCII(SUBSTR(P1,2,1))+1) || ISEQID;
          END IF;
     ELSE
          if p1 is null then
               bind2 := 'AA' || ISEQID;          
          else
               IF ISEQID <= 9999 THEN
               bind2 := SUBSTR(P1,1,2) || ISEQID;
               Else
               bind2 := CHR(ASCII(SUBSTR(P1,1,1))+1) || 'A' || ISEQID;          
               End If;
          End If;
     END IF;
     return bind2;
     END;

Similar Messages

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

  • Call Stored Procedure inside a db trigger

    Is that possible to call stored procedure inside a db trigger ?
    I User this code:
    Create Or Replace Trigger Sale.Send_Auto_Email_Trg
    After Insert
    On Sale.Sale_Technical_Support
    --Referencing New As New Old As Old
    For Each Row
    Declare
    Pragma Autonomous_Transaction;
    vn_count         Number := 0;
    vn_msg           Number;
    vv_exec          Varchar2(5000);
    Begin
      If Inserting And :New.Ticket_Status = 2 Then
       Begin
        Begin
         Select Count(*)
           Into vn_count
           From Sale_Technical_Support
          Where Sending_Flag = 1
            And Support_Type = 2;
        Exception When No_Data_Found Then
         vn_count := 0;
        End;
        If vn_count >= 1 And :New.Problem_Desc Is Not Null Then
         Technical_Support_Mailing('[email protected]',  -- To
                                   '[email protected]',
                                   '[email protected]',  -- Bcc
                                   '[email protected]',  -- From
                                   'رموز وصلاحيات',
                                   2);                                                                                          
        End If;
       End;
      End If;
    End;
    /No errors but the procedure doesn't executed !!!!!

    1) If you are using autonomous transactions for anything other that writing log data that you want to preserve even if the triggering transaction fails, you're probably doing something wrong. There is no reason to use an autonomous transaction here.
    2) You don't want to send email from a trigger. You don't want to do anything non-transactional in a trigger. Oracle will, for example, rollback and re-execute parts of a statement for write consistency. If you send email in a trigger, you may get multiple emails for a single update. You may also get emails for updates that were never committed. And if the email server happens to be down, your transactions will fail.
    3) If you use an autonomous transaction, the trigger will have a completely different transaction context from the parent. So when you query the table within the trigger, you won't be able to see any of the uncommitted changes including the changes that caused the trigger to fire. My guess is that you are assuming that the row that you inserted is visible to the trigger.
    Justin

  • Call a procedure in a function to create an Index

    Hi,
    i want to doing a text search and have to create some index
    to doing that. I have to choose between create two index according to
    what a search i want to doing.
    The function, which call the sql-statement to search the text is:
    CREATE OR REPLACE FUNCTION SEARCHTEXT(textToSearch IN VARCHAR2)
    RETURN utilities.resultset_ft PIPELINED AS
    BEGIN
    BEGIN
    INDEXTEST;
    END;
    DBMS_OUTPUT.PUT_LINE('get the data');
    -- search the Text in the database Documents
    FOR i in
    (SELECT extract(Document, '/*/*/*/*/location[1]/uri/text()').getStringVal() as location, score(1) as score_nbr
    FROM Mydocuments
    WHERE contains(Document, textTosearch, 1) &gt; 0
    ORDER BY score_nbr)
    LOOP
    PIPE ROW(i);
    END LOOP;
    RETURN;
    END ;
    This function call the procedure "INDEXTEST", which create the index.
    CREATE OR REPLACE PROCEDURE INDEXTEST
    AS
    BEGIN
    EXECUTE IMMEDIATE 'CREATE INDEX FTS_INDEX ON Mydocuments (DOCUMENT)' || ' ' ||
    'INDEXTYPE IS CTXSYS.CONTEXT' || ' ' ||
    'PARAMETERS (''' || 'stoplist Doc_stoplist' || ' ' ||
    'section group CTXSYS.PATH_SECTION_GROUP'')';
    EXCEPTION
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE(sqlerrm);
    END INDEXTEST;
    I call the statement:
    select *
    from TABLE(searchtext('%Let%'))
    and i get this error:
    Error starting at line 1 in command:
    select *
    from TABLE(searchtext('%Let%'))
    Error report:
    SQL Error: ORA-14552: DDL-, Commit- oder Rollback-Vorgang kann innerhalb einer Abfrage oder DML nicht durchgef&uuml;hrt werden
    ORA-06512: in "INDEXTEST", Zeile 5
    ORA-06512: in "SEARCHTEXT", Zeile 15
    14552. 00000 - "cannot perform a DDL, commit or rollback inside a query or DML "
    Cause:    DDL operations like creation tables, views etc. and transaction<br /><br />control statements such as commit/rollback cannot be performed<br /><br />inside a query or a DML statement.<br /><br />Action: Ensure that the offending operation is not performed or
    use autonomous transactions to perform the operation within
    the query/DML operation.
    <p>
    Can someone help me?
    </p>
    Thanks for help

    So, in answer to your question, how to do this....
    Create the necessary indexes before you issue the query to do the search.
    Yes, that means you need to have some intermediate steps to do it, but you should be able to control that from your application level.
    e.g.
    1. User enters search criteria
    2. Application processes criteria and creates necessary indexes
    3. Application queries the results
    4. Application drops the indexes.
    Or, alternatively, it may be an idea to have a look at your overall design and solve the issue why you are actually having to try and create indexes on the fly. If the database structure was correct in the first place then you shouldn't have to create any more indexes than the permanent ones you will have already determined.

  • To call Java Procedure inside Forms6i

    How do i call a java procedure (Stored either in Oracle8i database or application server )from Oracle Forms6i trigger / procedure.If this possible please let me know.
    Your help in this regard would be appreciated

    For java procedures in the database (stored java procedures) you just call the pl/sql wrapper function that was created for the java function.
    To call java functions on the application server you can use the java importer utility available with forms6i patch2 and above.

  • Can you call a procedure inside another procedure and how many?

    Ok. I have 3 procedures. I would like to call 2 of the from inside one, but I would like them to be in order.
    So,
    procedure1 // this is in db1
         call procedure2
                this collects, and inserts data into table 2 from db1
                this must be run first
         call procedure3
               this update the table1, and table2 from db2, and db3
               this must be run second
         finish procedure1
               this also updates table1 and table2 from db1 and db3
               this must be run third
    procedure1 end;or should I call a function
    procedures 2, and 3 have there own dblinks to other dbs to gather datat, procedure1 is in the same db.
    the procedures dont have to be like above. If you want to run proc3, and call proc1, and proc2 first so be it. Just an example

    create or replace myPackage
    is
    procedure1;
    procedure2;
    procedure3;
    end myPackage;
    create or replace myPackage body
    is
      procedure1 is
      begin
        -- call 2
        procedure2;
        -- call 3
        procedure3;
      end procedure1;
      procedure2 is
      begin
        do_something_here;
      end procedure2;
      procedure3 is
      begin
        do_something_here;
      end procedure3;
    end myPackage;
    /* now run the procedure1 from sql*plus */
    execute myPackage.Procedure1;Message was edited by:
    Sven W. added packaged call

  • Calling stored procedure inside AM. DB connection and updates on act/passiv

    Hi Experts,
    Currently in my application we have view objects and also we have some stored procedure calls to insert and update data (in the procedure we don't commit it. Due to the volume and complexity we couldn't migrate all the procedures). After the stored procedure call we do refresh the VO (Also in the EO we have checked necessary attributes to refresh on update and insert) to pick up the changes that happened in the stored procedure call. It is working fine and i can be able to see the updated values in the VO after the procedure call. However
    Now my question is what will happen on activation and passivation? In the passivation the pinned DB connection is released and used for another AM. Will the stored changes will be rolled back. I mean the DB transaction. If rollback then the VO updates based on the procedure call will be also rolled back? I have tested this behaviour after disabled the AM pooling and set the pool size to 1. It is working but failing some times (In the procedure i have data insert for the child table, after the refresh i could be able to see the child VOs, some times empty child). Did anyone try this approach before?
    Also what will happen if AM goes to passivation during the stored procedure executing ( i am getting the DB connection from getDBTransaction(() method). When i was testing i got the resultset null and i checked the stack and it was due to the connection closed). If AM behaves it like that is it reliable to use procedure call inside the AM?
    Looking forward you expertise answers.
    Thanks

    Hi,
    I agree with Frank.
    In our application we always commit after calling PL/SQL procedures which performs DML-Statements (insert, update, delete).
    Without commits you will - beside the passivation problem - face problems with locked records in the database.
    To refresh the values from DB we use the "restore current row after rollback" approach (which is applicable for commit too).
    regards
    Peter

  • Calling Stored procedure inside an Stored procedure

    Hi,
    I am working in oracle 9i. I want to call a stored procdure from another stored procedure.
    Kindly provide me the example...
    rgds.

    having a pocedure called PRCD1,
    Create or Replace Procedure PRCD2 IS
    egin
    PRCD1;
    END;
    cheers !!!It will for surely err out. You cannot use "EXECUTE" inside a stored procedure.
    Here's how you do it:
    SQL> create or replace procedure p1 is
      2  begin
      3    dbms_output.put_line('I am P1');
      4  end;
      5  /
    Procedure created.
    SQL> create or replace procedure p2 is
      2  begin
      3    dbms_output.put_line('I am P2');
      4    p1;
      5  end;
      6  /
    Procedure created.
    SQL> set serveroutput on
    SQL> exec p2
    I am P2
    I am P1
    PL/SQL procedure successfully completed.
    SQL>

  • Prob. in Executing dynamic stored procedure inside a function where S.P....

    Hi,
    My Stored Procedure is
    create or replace procedure concatname(a varchar2,
    b varchar2,
    c out varchar2)
    as
    begin
    c := a || b;
    end;
    My Function is
    create or replace function ex(sp varchar2)
    return varchar2 as
    v varchar2(100);
    begin
    execute immediate 'begin '||sp||'(''test'','' procedure'',:o); end;'
    using out v;
    return v;
    end;
    Iam using PowerBuilder 8 as a FRONT END Tool ( connecting to ORACLE db - 10gR2 through ODBC driver) for executing the above function where i will pass the stored procedure name ( CONCATNAME ) as an argument.
    The function is executing fine when i execute through ISQL interface.
    While executing this function from the front end tool( POWER BUILDER ) iam getting the following error.
    ORA-03113: end-of-file on communication channel.
    I dont know, why this error is coming ? As the function is executing fine
    through ISQL ?
    I think this error will come if you execute the above function from any front
    end tool( like .Net etc. ).
    Can anybody help me ? How to avoid this error ( ORA-03113 ) ?
    For Your Information: All other simple functions are executing fine through POWER BUILDER in my application.

    ORA-03113: end-of-file on communication channel is a client driver error. It is a symptom of a problem - it is not the problem itself.
    This error message simply says that your client was still talking to the database service process servicing your client session, when that (TCP/IP socket) connection was unexpectedly torn down by the server.
    This is often caused by that database service process crashing due to an internal (ORA-0600) error - and taking the TCP/IP connection down with it.
    You need to ask your DBA to have a look at the alert log file for the Oracle instance. The crash will be recorded there. In addition a trace file should have been created.
    Using the 1st parameter of the ORA-0600 message for the crash in the alert log file, the DBA should lookup the possible causes of the crash on Metalink note 153788.1

  • Calling packaged procedure from a function

    Hi all,
    I am using Oracle database 10.2.0
    I have a packaged procedure , there are two IN parameters(Varchar, Date) and an OUT parameter(REF CURSOR). The out parameter sends a result set from a query(multiple records of a table). I was asked to create a function which can use this procedure and returns the same resultset. Can u please suggest how to proceed?
    Thanks & Regards,
    Naveen.

    Is it something like this you're after:
    SQL> create or replace function test_f (p_In1 in number, p_In2 in varchar2) return sys_refcursor as
      2    r sys_refcursor;
      3    begin
      4      open r for 'select ' || to_char(p_In1) || ',''' || p_In2 || ''' from dual';
      5      return  r;
      6  end test_f;
      7  /
    Function created.
    SQL> declare
      2    r sys_refcursor;
      3   
      4    l_no number;
      5    l_Greet varchar2(30);
      6  begin
      7    r := test_f(1, 'Hello');
      8   
      9    fetch r into l_no, l_Greet;
    10    if (r%found) then
    11      dbms_output.put_line(l_No || ' ' || l_Greet);
    12    end if;
    13   
    14    close r;
    15   
    16    exception
    17      when others then
    18        dbms_output.put_line('Err ' || sqlerrm);
    19        if (r%isopen) then
    20          close r;
    21        end if;
    22 
    23  end;
    24  /
    1 Hello
    PL/SQL procedure successfully completed.P;
    Edited by: bluefrog on Mar 4, 2010 3:16 PM

  • Calling custom screen inside a function module

    This is regarding calling a screen as a pop up from a function module.How do I capture the values that would be entered in the fields of that pop up screen?Do I use ABAP memory or SAP memory or is there any other alternative?Please suggest.

    Hi savitha,
    When you create the Custom Screen, you can attach that custom screen to the main program of the function module itslef.
    The TOP Include variables can be used as screen fields and hence you don't need to store the data entered in the screen, anywhere else.
    The data will be readily available in the global variables itself in the whole function group..
    Thanks and Regards,
    Kunjal Patel

  • How to call a procedure inside a trigger?

    hi people,
    I have a trigger which cals a stored proc named PY.but i couldn get dis trigger worked out.can u pls sugges me?.the trigger is as follows.
    create or replace trigger ts after insert on s
    for each row
    begin
    call py
    if this trigger gets successfully created its enough for me.gimme some ideas.Thanks in advance.
    regards
    VIDS

    Hi,
    create or replace trigger ts after insert on s
    for each row
    begin
    call py
    just call 'py' no need of calling 'call py'.....
    create or replace trigger ts after insert on s
    for each row
    begin
    py;
    If it helps mark question as anwered or helpfull....
    Thanks,
    Pavan

  • Funtion calling a procedure (getting errors)

    HI,
    I am calling a procedure inside a function(see code below).
    Please see my second post for the code:
    Message was edited by:
    SeshuGiri

    Ok here's a working example, though it doesn't use your data:
    set echo on
    drop table data1
    drop table data1 succeeded.
    create table data1 (id number,
                        sel number,
                        col1 varchar2(15),
                        col2 varchar2(15),
                        col3 varchar2(15))
    create table succeeded.
    insert into data1
    select 1, 1, 'one-1','two-1','three-1' from dual union all
    select 1, 1, 'one-2','two-2','three-2' from dual union all
    select 1, 1, 'one-3','two-3','three-3' from dual union all
    select 2, 2, 'one-4','two-4','three-4' from dual union all
    select 2, 2, 'one-5','two-5','three-5' from dual union all
    select 3, 1, 'one-6','two-6','three-6' from dual
    6 rows inserted
    drop type temp_data_tt
    drop type temp_data_tt succeeded.
    create or replace type temp_data as object (
      id number,
      col1 varchar2(15),
      col2 varchar2(15),
      col3 varchar2(15));
    type temp_data Compiled.
    create type temp_data_tt as table of temp_data;
    type temp_data_tt Compiled.
    create or replace procedure get_recs(criteria number, recs out sys_refcursor) is
    begin
      open recs for select id, col1, col2, col3 from data1 where id=criteria;
    end;
    procedure get_recs(criteria Compiled.
    create or replace function get_data(criteria number) return temp_data_tt pipelined is
      l_id number;
      col1 varchar2(15);
      col2 varchar2(15);
      col3 varchar2(15);
      rs sys_refcursor;
    begin
      for drv in (select distinct id from data1 where sel=criteria) loop
        get_recs(drv.id, rs);
        loop
          fetch rs into l_id, col1, col2, col3;
          exit when rs%notfound;
          pipe row(temp_data(l_id, col1,col2,col3));
        end loop;
        close rs;
      end loop;
      return;
    end;
    function get_data(criteria Compiled.
    select * from table(get_data(1))
    ID                     COL1            COL2            COL3           
    1                      one-1           two-1           three-1        
    1                      one-2           two-2           three-2        
    1                      one-3           two-3           three-3        
    3                      one-6           two-6           three-6        
    4 rows selected
    select * from table(get_data(2))
    ID                     COL1            COL2            COL3           
    2                      one-4           two-4           three-4        
    2                      one-5           two-5           three-5        
    2 rows selected
    select * from data1
    ID                     SEL                    COL1            COL2            COL3           
    1                      1                      one-1           two-1           three-1        
    1                      1                      one-2           two-2           three-2        
    1                      1                      one-3           two-3           three-3        
    2                      2                      one-4           two-4           three-4        
    2                      2                      one-5           two-5           three-5        
    3                      1                      one-6           two-6           three-6        
    6 rows selected

  • Calling Stored procedure from Forms 6i

    Dear all,
    I have a stored procedure having INand INOUT parameters. I need to call it from Forms 6i triggers. Will you please tell me the syntax for calling stored procedure and stored function from Forms 6i and report 6i.
    Saibaldas
    [email protected]

    Just the same as for a local procedure, the only restrictions concern package public variables which are not visible from client side PL/SQL, and you probly want to keep the interfaces simple as client side PL/SQL (e.g. the Forms and Reports engines) don't support the same range of datatypes that the database does.

  • How to call a procedure in place of a SQL

    Hi
    Can any one tell me how to call a procedure in place of a SQL from Bi publisher
    Thanks
    Ranga
    Edited by: user13274784 on Jul 22, 2010 9:47 AM

    One way would be to use pipelined table functions. Call the procedure within a function and return data in the form of a table.
    Search the forum.
    Check this out: http://winrichman.blogspot.com/search/label/pipelined
    http://bipublisher.blogspot.com/2007/09/plsql-taking-it-to-next-level.html
    BI publisher to use Stored Procedure
    Edited by: BIPuser on Jul 22, 2010 10:22 AM

Maybe you are looking for

  • How do I stop Firefox from archiving conversations after I send a message to someone?

    When someone sends me an email and I reply, the conversation automatically goes to the archive. I can retrieve it by clicking on the 'undo archive' link, but I want it to stop archiving things in the first place. It seems to do it no matter who the c

  • PDF silent printing

    Hi all i have a pdf that i generate with FOP then i want to print it in silent mode.I have try the FOAWTRenderer,PDFBox and the basic javax.print but the results are very far from the Acrobat or Foxit print. Any idea for this problem? Thanks

  • OWB 10G R2 with 9.2 DB....

    At my company the standard for databases is still 9.2. Since this is a large organization, we are a little slow to adopt the latest versions (we are still running OWB 9.2.0.8). According to the FAQ, Design repositories for OWB 10g R2 can be setup on

  • How can I remove Password protection

    I want to remove the passwrod protection to my site, but cannot find any directions on how to accomplish that. Please help.

  • Need CVS plug in with weblogic portal 10.3

    I tried to integrate the CVS plug in with Weblogic Portal 10.3 using software updates (Selecting Eclipse CVS Client 1.0.2.r33x), but getting the error - Weblogic Portal 10.3 requires feature "com.m7.nitrox(1.0.20)", or compatible Can someone help me