Pl/sql records usage

CREATE OR REPLACE PACKAGE CURSPKGex AS
TYPE T_CURSOR IS REF CURSOR;
TYPE emprec_typ IS RECORD (
v_eno emp.empno%type,
v_ename emp.ename%type,
v_dname dept.dname%type,
v_deptno dept.deptno%type
PROCEDURE OPEN_ONE_CURSORex (N_EMPNO IN NUMBER,
IO_CURSOR IN OUT T_CURSOR);
END CURSPKGex;
CREATE OR REPLACE PACKAGE BODY CURSPKGEX iS
PROCEDURE OPEN_ONE_CURSOREX (N_EMPNO IN NUMBER,IO_CURSOR IN OUT T_CURSOR)
IS
V_CURSOR T_CURSOR;
          v_rec emprec_typ;
BEGIN
IF N_EMPNO <7600
THEN
OPEN V_CURSOR FOR
SELECT EMP.EMPNO, EMP.ENAME, DEPT.DEPTNO, DEPT.DNAME
FROM EMP, DEPT
WHERE EMP.DEPTNO = DEPT.DEPTNO
AND EMP.EMPNO = N_EMPNO;
                    loop
                    fetch v_cursor into v_rec;
                    exit when v_cursor%notfound;
                    for i in v_rec.first ..v_rec.last
                    loop
                    dbms_output.put_line(v_rec(i).ename);
                    end loop;
                    end loop;
                    close v_cursor;
else
OPEN V_CURSOR FOR
SELECT EMP.EMPNO, EMP.ENAME, DEPT.DEPTNO, DEPT.DNAME
FROM EMP, DEPT
WHERE EMP.DEPTNO = DEPT.DEPTNO;
END IF;
END OPEN_ONE_CURSOREX;
END CURSPKGEX;
error is
PLS-00302: component 'FIRST' must be declared

v_rec is a record and not a pl/sql table. FIRST is only for pl/sql table.
you should use v_rec suffixed by their column name. Record is equivalent to 1 table row
like
CREATE OR REPLACE PACKAGE curspkgex
AS
   TYPE t_cursor IS REF CURSOR;
   TYPE emprec_typ IS RECORD (
      v_eno      emp.empno%TYPE,
      v_ename    emp.ename%TYPE,
      v_dname    dept.dname%TYPE,
      v_deptno   dept.deptno%TYPE
   PROCEDURE open_one_cursorex (n_empno IN NUMBER, io_cursor IN OUT t_cursor);
END curspkgex;
CREATE OR REPLACE PACKAGE BODY curspkgex
IS
   PROCEDURE open_one_cursorex (n_empno IN NUMBER, io_cursor IN OUT t_cursor)
   IS
      v_cursor   t_cursor;
      v_rec      emprec_typ;
   BEGIN
      IF n_empno < 7600
      THEN
         OPEN v_cursor FOR
            SELECT emp.empno, emp.ename, dept.deptno, dept.dname
              FROM emp, dept
             WHERE emp.deptno = dept.deptno AND emp.empno = n_empno;
         LOOP
            FETCH v_cursor
             INTO v_rec;
            EXIT WHEN v_cursor%NOTFOUND;
         --   FOR i IN v_rec.FIRST .. v_rec.LAST
         --   LOOP
               DBMS_OUTPUT.put_line (v_rec.ename);
         --   END LOOP;
        -- END LOOP;
         CLOSE v_cursor;
      ELSE
         OPEN v_cursor FOR
            SELECT emp.empno, emp.ename, dept.deptno, dept.dname
              FROM emp, dept
             WHERE emp.deptno = dept.deptno;
      END IF;
   END open_one_cursorex;
END curspkgex;
/Edited by: Helyos on 2 sept. 2008 13:55

Similar Messages

  • Pl/sql record - Memory usage

    Hi ,
    I'm using pl/sql record which hold 14,00,000 rows and process those rows one by one. Will this create memory problem in prodution?
    Here is the status of v$process
    SELECT spid, program,
    pga_max_mem max,
    pga_alloc_mem alloc,
    pga_used_mem used,
    pga_freeable_mem free
    FROM V$PROCESS
    WHERE addr='070000004DF60B18'
    SPID     PROGRAM     MAX     ALLOC     USED     FREE
    2326748     oracleax010     9629198358     9629132822     3623509662 5832704
    Thanks for your help!     
    kannan
    Edited by: user601042 on Sep 22, 2010 12:43 AM

    Actually in our design Global Temp table is not allowed..earlier each time we read data from table(14,00,000 rows one by one) and process those rows..This look long time for job to run. instead of that using bulk collect i'm collecting all 14,00,000 rows into collection(10000 rows each collect) and processing rows from collection and this reduced my process time to 1/5 of earlier. But its taking more memory..
    Used memory is 3GB ..Do we need to conside allocated momory or used memory?.If used memory is 3GB means fine?
    Thanks,
    kannan

  • SQL Memory Usage

    Hello
    I am updating some items with the DTW. i am updating 9000 items. I have made 9 files of 1000 records, i am just updating the picturname field. When i start to upload the files the SQL Memory usage starts to grow more and more. When i try to upload the third file the memory has grown too much, and the DTW says the file update ok but it doesnt update the database. So i need to restart the SQL service (mssqlserver) and do it again. Some times it doesnt work so i need to restart the server.
    Any ideas??
    Jacobo

    hi,
    Check this information abt DI API Memory Consumption in WIKI SDK FAQ's.
    https://www.sdn.sap.com/irj/scn/wiki?path=/display/b1/faq_sdk
    DI API
    Memory consumption
    New connection mechanism in 2007 vs. classical
    1. In the old method the DI API was loaded into the same process with the Add-On and was an "actual part" of it, so calls to the DI-API were very quick and direct
    2. In the new method there is one common DI-API which is part of the Core B1. All the Add-Ons will use the same DI-API IF (!!!) they work in the new method. The calls to the DI-API have now to "go between" two processes. This means that they go through more processing and although it's all in the same machine and no actual communication (i.e., network traffic) is actually happening, the system's CPU and memory are "working harder".
    The impact is extremely small on an individual call level, but for an Add-On that makes a large amount of calls this difference accumulates...
    There is no huge additional CPU or Memory consumption. Most of the impact is on the Response Time level. Some of it is CPU consumption and some of it is Context Switch waiting.
    3. This trade-off between Memory consumption and Response Time is actually another reason why R&D thought it's a good idea to leave the new method to be optional based on a decision from the developer.
    Jeyakanthan

  • Creating PL/SQL web services from PL/SQL records

    Hello
    Jdeveloper does not allow to create web services from pl/sql packages that use PL/SQL records.to do this,we have to use the jpublisher ?without using the jpublisher,if we create a webservice then the following error is displayed in the web service xml output file.
    <faultstring>Internal Server Error (Caught exception while handling request: java.rmi.RemoteException: java.sql.SQLException: ORA-06550: line 1, column 49: PLS-00181: unsupported preprocessor directive '$WS_SP_EVEN' )</faultstring>
    </env:Fault>
    Could any one suggest me, how to solve the above issue..?
    Regards
    Malathi

    Thank you, with db adapter it was working and also
    pl/sql web-services working successfully with object types.If we want to send the web-services to the client, do we need to send the entire folder that is created in the web-services folder of the external oc4j..?
    Creating the client process:
    we are using the wsdl file that is generated in the web-services and adding to the partner link to Invoke the operations of web-services. Is there any other way to invoke the webservices?Could any one please suggest me?
    Thanking you
    Malathi

  • Dbms_xmlgen using pl-sql record type

    Hi
    I want to pass pl-sql record type and want to generate xml. Can dbms_xmlgen access pl-sql record type instead of query?
    OR please let me know any other package to pass pl-sql record type and generate XML.
    Thanks in advance

    Can dbms_xmlgen access pl-sql record type instead of query?Don't think so, but can't you pass the individual record components:
    SQL> declare
      type rec is record
        a   int,
        b   varchar2 (30)
      r     rec;
      ctx   int;
      x     xmltype;
    begin
      r.a := 1;
      r.b := 'Michael';
      ctx := dbms_xmlgen.newcontext ('select :x id, :y name from dual');
      dbms_xmlgen.setbindvalue (ctx, 'x', r.a);
      dbms_xmlgen.setbindvalue (ctx, 'y', r.b);
      x := dbms_xmlgen.getxmltype (ctx);
      dbms_output.put_line (x.getstringval ());
      dbms_xmlgen.closecontext (ctx);
    end;
    <ROWSET>
    <ROW>
      <ID>1</ID>
      <NAME>Michael</NAME>
    </ROW>
    </ROWSET>
    PL/SQL procedure successfully completed.?

  • How to update by using PL/SQL Records

    Hi,
    I want to update EMP table columns ename and empno only
    from other existing table TEST_EMP
    EMP table contains 14 rows.TEST_EMP table contains 3 rows.
    I need to update first three rows in EMP table.
    TEST_EMP DATA IS:
    ENAME EMPNO
    E1 1001
    E2 1002
    E3 1003
    Following code i written to update EMP table.
    DECLARE
    type r is record(id emp.empno%type,
         name emp.ename%type);
    r1 r;          
    BEGIN
    select ename,empno into r1 from test_emp;
    FOR i IN r1.FIRST .. r1.LAST
    LOOP
    update emp2
    set ename=r1(i).ename,
    empno=r1(i).empno
    WHERE empno = l_rc (i).empno;
    end loop;
    commit;
    EXCEPTION
    WHEN OTHERS
    THEN
    DBMS_OUTPUT.put_line (SQLERRM (SQLCODE));
    END;
    ERROR OCCURRED:
    ORA-06550: line 9, column 14:
    PLS-00302: component 'FIRST' must be declared
    ORA-06550: line 9, column 2:
    PL/SQL: Statement ignored
    I should use PL/SQL Record to update Table This is Mandatory.
    pls guide me.
    Regards,
    Venkat.

    > I want to update EMP table columns ename and empno only
    from other existing table TEST_EMP
    Why use PL/SQL and why use cursors?
    You are running a SELECT on the source table via the SQL engine and pulling that data from the db buffer cache into PL/SQL variables.
    Then you take that very same data, and push that back to the SQL engine using an UPDATE.
    So if you need to update 10KB worth of data, it means pulling 10KB from the SQL engine into the PL engine.. and then pushing 10KB of data from the PL engine back to the SQL engine.
    Not only pushing and pulling - you need your code to switch continually between the PL and SQL engines to do this.
    Now imagine doing it for 10MB of data.. or 1GB of data.. or more.
    Does it sound like your approach is effective? Does it sounds like it will perform well? Does it sound like it will scale?
    The basic rule for Oracle development is:
    Maximize SQL. Minimize PL/SQL (or Java or C#, etc).

  • Can you confirm for me please? - jdbc to pl/sql record types

    Hi, I was hoping somebody could confirm the following please? I've been researching this in the Oracle JDBC docs and the Internet, but would feel more comfortable if somebody would confirm my findings.
    I have a 10g database pl/sql procedure that takes a pl/sql record type as both IN and OUT parameter. I'm not allowed to modify this legacy procedure, though I may create new supporting code.
    My research shows there is no inherit support in JDBC for Oracle pl/sql record types as per the Oracle JDBC docs.
    As a solution, if the procedure only returned a record type, my understanding is I could create a ref cursor in pl/sql, as well as a wrapper procedure that calls my original procedure, and returns the record type through the ref cursor. This could then be used by my JDBC code as JDBC supports ref cursors as a return type.
    However in my case, as the record type is both an IN and OUT parameter of my procedure, my research so far says JDBC support for ref cursors does not allow the writing of value to the ref cursor to be submitted back to the database. Is this correct?
    If this limitation exists, as such the better (and only?) solution is to create a shadow pl/sql procedure that takes all the record elements as separate IN OUT parameters and then create a private record based on the record type and pass it to the original procedure.
    Is my research here correct? Any help appreciated.
    Thanks & regards,
    CM.

    Chris,
    As far as I know, PL/SQL record types are not supported in JDBC.
    I believe you may be able to use TopLink.
    I think Kuassi Mensah may have some examples in his book Oracle Database Programming.
    Alternatively, you could use an Oracle object instead of a PL/SQL record.
    This would be similar to what you are suggesting except that instead of a ref cursor, you would transfer the PL/SQL record to an Oracle object.
    Good Luck,
    Avi.

  • Deleting old data won't reduce Windows Azure SQL Database usage

    My Windows Azure SQL Database usage keeps increasing. Deleting old data didn't help much. I was wondering how to figure out the distribution of the usage. All tables in my DB should not occupy more than 5GB and now it is most 12GB. Please help!
    http://yanflex.com

    Hello,
    The database fee is amortized over the month and charged daily. The daily fee depends on the peak size that each database reached that day and the maximum number of databases you use. So, if the peak size of database is 12 GB  and then you delete data
    to reduce the size, it still charge based on 12GB this day.
    You can use the following statement to get the database size:
    SELECT SUM(reserved_page_count)*8.0/1024 as DBsizeinMB
    FROM sys.dm_db_partition_stats;
    Reference:Accounts and Billing in Windows Azure SQL Database
    Regards,
    Fanny Liu
    If you have any feedback on our support, please click here.
    Fanny Liu
    TechNet Community Support

  • Sql memory usage increase each time win app runs

    Hi,
    Sql memory usage increases each time when win app runs. Why does it work like this? Is it normal ?
    I restart SQL Server 2012. Only my win app uses SQL server.
    First run of winapp.
    start memory usage : 211.800 KB
    close memory usage: 528.136 KB
    Second run of xaf app.
    start memory usage : 528.136 KB
    close memory usage: 996.844 KB
    Third run of xaf app
    start memory usage : 996.844 KB
    close memory usage: 997.640 KB
    Fourth run of xaf app
    start memory usage : 997.640 KB
    close memory usage: 1.104.864 KB

    Hi,
    Sql memory usage increases each time when win app runs. Why does it work like this? Is it normal ?
    Yes, it is perfectly normal for SQL Server to acquire and hold onto large amounts of memory indefinitely.  This memory improves performance by avoiding disk I/O, query plan compilation and costly memory management. 
    On a dedicated SQL Server you should usually let SQL Server dynamically manage memory.  It will release memory if it detects memory pressure.  But if you often run other applications on the server than need significant amounts of memory (e.g. IIS,
    application services), you may want to set max server memory as suggested.
    Dan Guzman, SQL Server MVP, http://www.dbdelta.com

  • Support for PL/SQL Record

    We have a procedure in a package,this procedure makes use of a Record Type.
    In BPEL, whiile creating the partner link, when we are trying to access this procedure we get the following error.
    "WSDLException:faultCode=OTHER_ERROR:Database type is either not supported or is not implemented.
    Parameter L_ECO_REC is of type SAN_REC_TYPE which is either not supported or not an implemented data type.
    Check to ensure that the type of the parameter is one of the supported datatypes or that there is a collection or user defined type definition representing this type defined in the database.contact oracle support if error is not fixable."
    Also please find below the package specification and body:
    CREATE OR REPLACE package eco_pack is
    TYPE San_Rec_Type IS RECORD
    ( Eco_Name VARCHAR2(10)
    , Change_Notice_Prefix VARCHAR2(10)
    , Change_Notice_Number NUMBER
    , Organization_Code VARCHAR2(3)
    PROCEDURE sandeep(l_eco_rec IN eco_pack.San_Rec_Type);
    end;
    CREATE OR REPLACE package body eco_pack is
    PROCEDURE createeco(l_eco_rec IN eco_pack.San_Rec_Type) AS
    BEGIN
    INSERT
    INTO ag_log
    VALUES(1, 'ECO name is' || l_eco_rec.eco_name, 1);
    COMMIT;
    END;
    end;
    Does BPEl support PL/SQL Record Type, if so how ?
    Thanks,
    Shivram
    .

    PL/SQL types like RECORD, BOOLEAN and TABLE are not supported in the DB adapter with the current BPEL PM release (as the error message indicates). You can use JPublisher manually to generate an OBJECT type that corresponds with the RECORD. JPublisher will also create a wrapper and conversion APIs to convert between the two. You would then call the wrapper API which takes the OBJECT and then calls the underlying PL/SQL that takes the RECORD.
    With the 10.1.2 Phase 2 release of BPEL PM, the DB adapter does all of this for you from within the design time wizard. JPublisher is invoked silently under the covers, the SQL that gets generated is automatically loaded into the database schema. That will create the OBJECT type, wrapper and conversion APIs. An XSD is generated for the wrapper API. Your partner link will invoke the wrapper, not the original API.
    Note also that support for BOOLEAN and TABLE was also added. JPublisher generates wrapper APIs that substitute appropriate types for these parameters (e.g. INTEGER for BOOLEAN, Nested Table for TABLE).

  • MERGE with PL/SQL Record As Source

    I have a very complex process that populates a PL/SQL record. This resulting record is identical to a database table and, once built, corresponds directly to 1 row of contents for the database table. The record that is populated is even declared by binding it to the tables ROWTYPE, e.g. lrec_OracleCitation OD_CITATION_STAGING%ROWTYPE.
    The record that is built may or may not already be present in the database table. If it is present, I want to UPDATE using the record. If it isn't present, I want to do an INSERT. Sounds like a perfect opportunity for a MERGE statement, right?
    So, here's my question, I already have the info I need in the reocrd, can I use the in the MERGE? If so, how do I reference it?
    MERGE INTO OD_CITATION_STAGING
    USING lrec_OracleCitation
    ON ( OD_CITATION_STAGING.CITATION_NO = lrec_OracleCitation.CITATION_NO )
    etc.
    This obviously doesn't work. Anyway to use a some sort of Collection Pseudo-Function or something to make it appear as a table to the MERGE statement?
    -Joe

    The USING clause will usually be based on the table supplying the updates - that is why I had mentioned the SQL type and the TABLE function.
    Now that I better understand what you are trying to do, your code will work, but I don't think you want to add as many new rows as the number of rows in OD_CITATION_STAGING - which is what will happen with the code you posted (or you'll hit a unique constraint if citation_no is a primary key).
    Instead, I think you'll want:
    using (select null from dual)so that only one row is inserted or updated.

  • Passing PL/SQL Record back to VB5 as Parameter

    Can anyone please help with this code.
    I am passing pl/sql record back to VB 5 app as parameter and having no joy.
    MY code
    Package TEST_PKG
    IS
    TYPE Brian_Test IS RECORD(
    First_answer Number :=0,
    Second_answer Number := 0
    -- Brian_Record Brian_test;
    END; -- Package Specification TEST_PKG
    Procedure ADD_NUMBER ( NUMBER1 IN NUMBER, NUMBER2 IN NUMBER, ANSWER OUT test_pkg.Brian_test, status OUT VARCHAR)
    IS
    -- Person Date Comments
    -- Timothy Adetunji 05/02/2001 Test Procedure for Brian May to verify how to execute procedures from VB
    -- variable_name datatype;
    -- Declare program variables as shown above
    BEGIN
    answer.first_answer := nvl(number1,0) + nvl(Number2,0);
    answer.second_answer := nvl(number1,0) - nvl(Number2,0);
    status := 'Ok';
    EXCEPTION
    WHEN others THEN
    status := 'Bad';
    END; -- Procedure ADD_NUMBER
    VB doesn't seem to understand records as parameter. I am able to pass individual variable but not in a reecord.
    My production codes requires me to pass 25 variables and it will be senseless to pass them individually.
    Thanks

    Hi
    This shld be the way to write
    Package TEST_PKG AS TYPE Brian_Test AS RECORD(
    First_answer Number :=0,
    Second_answer Number := 0);
    TYPE RCT1 IS REF CURSOR RETURN Brian_Test;
    END;
    Procedure ADD_NUMBER (
    NUMBER1 IN NUMBER,
    NUMBER2 IN NUMBER,
    status OUT VARCHAR2,
    RC1 IN OUT TEST_PKG.RCT1) AS
    BEGIN
    OPEN RC1 FOR
    SELECT nvl(number1,0) + nvl(Number2,0),
    nvl(number1,0) - nvl(Number2,0)
    FROM DUAL;
    status := 'Ok';
    RETURN;
    EXCEPTION
    WHEN others THEN
    OPEN RC1 FOR
    SELECT nvl(number1,0) + nvl(Number2,0),
    nvl(number1,0) - nvl(Number2,0)
    FROM DUAL;
    status := 'Bad';
    RETURN;
    END; -- Procedure ADD_NUMBER
    Compile this and try
    Have Fun!
    r@m@

  • Passing PL/SQL Record to a Oracle Stored Procedure from Java.

    Hi There.
    Can someone let me know how to pass pl/sql records in java/oa framework. For E.g :
    Package Specification:
    create or replace package pkg is
    type rec_type is record (n number, d date, v varchar2(1));
    rec rec_type;
    procedure p (r IN rec_type);
    end ;
    Package body :
    create or replace package body pkg is
    procedure p (r IN rec_type) is
    begin
    dbms_output.put_line('The values passed to the procedure are' || r.n||r.d||r.v);
    end p ;
    end pkg;
    Actual pl/sql Call (I need counter part of below code in Java)
    declare
    r1 pkg.rec%type;
    begin
    r1.n := 7; r1.d := sysdate; r1.v := 'R';
    pkg.p(r1); -- > How to do similar call using OracleCallableStatement
    end;

    Hi
    I am not sure whether you have check [this.|http://mukx.blogspot.com/2007/12/passing-plsql-table-to-java-using.html]
    Thanks
    Shailendra

  • Unable to INSERT PL/SQL  record with EXECUTE IMMEDIATE

    Hi All,
    I am selecting data from a source table and after some modification inserting into a target table. Source and target table name are available at run time. You can say only source table structure is fixed.
    I have crated a pl/sql table of type source record and inserting record by record in target table using execute immediate. But I am not able to write
    EXECUTE IMMEDIATE string USING pl_sql_table(index); and getting error as
    PLS-00457: expressions have to be of SQL types
    Please see the part of code below. Is it possible to use FORALL with dynamic sql like
    FORALL pl_sql_table.FIRST .. pl_sql_table.COUNT
    EXECUTE IMMEDIATE .... pl_sql_table(j); -- Like this.
    Please suggest why I am not able to write record here. I also want to replace 'INSERT in a loop' with a single INSERT statement out of the loop, to upload whole pl_sql table into target table in one go.
    Thanks,
    Ravi
    DECLARE
        TYPE rec_tab_CMP IS RECORD
         model_id          NUMBER(38),   
         absolute_rank          NUMBER(5)         
        v_rec_tab_CMP  rec_tab_CMP;
        TYPE t_rec_tab_CMP IS TABLE OF v_rec_tab_CMP%TYPE INDEX BY BINARY_INTEGER;
        v_records_CMP               t_rec_tab_CMP;
        rc                          SYS_REFCURSOR;
        v_old_table_name            VARCHAR2(30); -- passed from parameter 
        v_new_table_name            VARCHAR2(30); -- passed from parameter 
        dyn_str                     VARCHAR2(500);
        v_columns_str               VARCHAR2(200) := ' model_id, absolute_rank ';
    BEGIN
           EXECUTE IMMEDIATE 'CREATE TABLE '|| v_new_table_name || ' AS SELECT * FROM ' || v_old_table_name ||' WHERE 1 = 2 ' ;
         OPEN rc FOR 'SELECT '|| v_columns_str ||' FROM '|| v_old_table_name;
         FETCH rc BULK COLLECT INTO v_records_CMP;
         FOR j IN 1..v_records_CMP.COUNT
         LOOP
            v_records_CMP(j).model_id := 1; -- Do someting here, This thing can be performed in SQL stmt directly.
            dyn_str := 'INSERT INTO '|| v_new_table_name ||' ( '|| v_columns_str || ' ) VALUES (:1, :2) ';
            EXECUTE IMMEDIATE dyn_str USING v_records_CMP(j).model_id          ,
                                v_records_CMP(j).absolute_rank     ;
         -- Here in place of two columns I want to use one record like
         -- EXECUTE IMMEDIATE dyn_str USING v_records_CMP(j);
         -- But it is giving me error like
            --          EXECUTE IMMEDIATE dyn_str USING v_records_st(j);
            --   PLS-00457: expressions have to be of SQL types
         END LOOP;
         CLOSE rc;
    END;
    /

    You cannot bind PL/SQL record types to dynamic SQL.
    Possibly you could work around this by declaring the INDEX-BY table of records at package specification level, e.g.
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
    SQL> CREATE PACKAGE package_name
      2  AS
      3     TYPE tt_emp IS TABLE OF emp%ROWTYPE;
      4     t_emp tt_emp;
      5  END package_name;
      6  /
    Package created.
    SQL> CREATE TABLE new_emp
      2  AS
      3     SELECT *
      4     FROM   emp
      5     WHERE  1 = 0;
    Table created.
    SQL> DECLARE
      2     v_table_name user_tables.table_name%TYPE := 'NEW_EMP';
      3  BEGIN
      4     SELECT *
      5     BULK COLLECT INTO package_name.t_emp
      6     FROM   emp;
      7
      8     EXECUTE IMMEDIATE
      9        'BEGIN ' ||
    10        '   FORALL i IN 1 ..package_name.t_emp.COUNT ' ||
    11        '      INSERT INTO ' || v_table_name ||
    12        '      VALUES package_name.t_emp (i); ' ||
    13        'END;';
    14  END;
    15  /
    PL/SQL procedure successfully completed.
    SQL> SELECT empno, ename
      2  FROM   new_emp;
         EMPNO ENAME
          7369 SMITH
          7499 ALLEN
          7521 WARD
          7566 JONES
          7654 MARTIN
          7698 BLAKE
          7782 CLARK
          7788 SCOTT
          7839 KING
          7844 TURNER
          7876 ADAMS
          7900 JAMES
          7902 FORD
          7934 MILLER
    14 rows selected.
    SQL>

  • Any way to encode/decode PL/SQL record types ?

    Hello everyone,
    I came to XDK because I was looking for an easy way or working around a JDBC driver limitation. Namely that it does not access PL/SQL record types. I thought the best way was to encode my package's public types into XML streams and wrap up each public routine into a set of routines receiving and exporting data in XML.
    I installed XDK 9i/PL/SQL yesterday and tried it on my 8.1.6 db. So far so good.
    However, I did not see anything that does not access directly the database. The only preocupation of XSU is to access directly the DB for a variety of select, insert...
    Am I wrong ?
    I'm looking for a routine that takes an XML varchar, a DTD varchar and some description of my type (to map tags to fields) and parses the whole thing...
    Is there anything I could use to do that ???
    Thanks in advance...
    Alain

    Marwim wrote:
    You code should be instrumented. Whenever you need to debug/trace you switch it on and get a log fileor log table; it maybe a database parameter or simply a package variable, which you can set at runtime.
    This will allow you to debug a production environment where you should never be allowed to change the code or to use adebugger.And very valuable advice this is...
    Debugging needs to be part and parcel of a code unit (like a PL/SQL package), where you can execute it (in production or anywhere else) and tell it "+go forth, execute, and debug thyself+".

Maybe you are looking for