%ROWTYPE variables

Hi all,
IS there any way to compare two %ROWTYPE variables ?
thanks

As far as I know there is not a way to compare them directly but I think the best forum for this is:
Forums Home » Oracle Technology Network (OTN) » Products » Database » SQL and PL/SQL
Discussion of Oracle SQL and PL/SQL issues
PL/SQL
Joel Pérez
http://otn.oracle.com/experts

Similar Messages

  • Access fields in a Rowtype variable

    Hello!
    Is it possible to access dynamically to the fields of a rowtype variable?
    For example, I have the following code :
    CURSOR cursorName IS
    SELECT field1, field2,field3, ..., fieldN FROM myTable;
    myVar cursorName%ROWTYPE;
    myString := myVar.field1 || ';' || myVar.field2 || ... || myVar.fieldN;
    Is it possible tu use a collection such as :
    For each field IN myVar
    myString := myString || field;
    Next
    Many thanks for your answers!

    If the class you specify in the .NET adapter has public properties or fields then it should let you do "Get Property". Make sure the fields are really public and that you have the right class specified for the objects you are accessing.
    Basically, if you are storing the objects in a teststand object array, then the elements of the teststand object array are already the same as the elements of the dotnet array. You can just loop based on the number of items in the array and make calls by specifying Locals.myarray[Locals.i] as the class object (for example) when you specify the .NET step inside the loop. Be sure to uncheck the "Create object" checkbox as you want to use the object you are specifying by expression rather than creating a new one.
    Hope this helps,
    -Doug

  • INSERT using a %ROWTYPE variable

    In PL/SQL I need to "copy" a row in a table, changing the sequence number in a key and changing a couple of other columns. Most of the 20 or so columns are unchanged. I declare a variable using %ROWTYPE, to hold the entire row, and do a SELECT into it. Then I change the 3 columns, and want to do an INSERT, using the %ROWTYPE variable. But it seems that INSERT does not let me do this - I have to specify all the columns individually. This is tedious, and also means I have to know all the columns, which is bad for maintenance (new columns added in the future). Is there a way to INSERT the entire row? Whay does Oracle not allow this?
    Dave E. at McGill Univ.

    Oracle will allow this....but in Oracle9i and after. Right now you cannot do this in Oracle8i or less.
    Gio
    null

  • Select values from table%ROWTYPE variable into a cursor

    I have a stored procedure which has an OUT parameter of table1%ROWTYPE.
    In future we might have to add more OUT parameters of table2%ROWTYPE etc. But at any point of time only one will have values.
    So instead of having table%ROWTYPE as OUT parameter, can I send these single row ( with variable values) in a cursor, so that declaration part atleast will not change.
    Is it possible to select values from table%ROWTYPE variable into a cursor.
    cursorOUT IS
    SELECT * FROM varREC;
    where varREC is table.ROWTYPE variable.
    Or which is the better solution in this situation.
    Thanks.

    SQL> var a refcursor
    SQL> declare
      2   bb emp%ROWTYPE;
      3  begin
      4   select * into bb from emp where rownum = 1;
      5   open :a for select bb.ename ename, bb.empno empno from dual;
      6  end;
      7  /
    PL/SQL procedure successfully completed.
    SQL> print a
    ENAME                                 EMPNO
    SMITH                                  7369Rgds.

  • PLS-00201 error when declaring ROWTYPE variable

    Hi,
    I want to declare the rec_ variable like this:
    PROCEDURE Insert___ (
    objid_ OUT VARCHAR2,
    objversion_ OUT VARCHAR2,
    new_ IN OUT VARCHAR2,
    attr_ IN OUT VARCHAR2 )
    IS
    rec_ OBUS.ORDER_TAB%ROWTYPE;
    where ORDER_TAB belongs to the OBUS schema, a different schema from where the present procedure is being created.
    When compiling, I get the following error:
    "PLS-00201: identifier 'OBUS.ORDER_TAB' must be declared"
    Why do I get this? Can't I refer to a different schema in the declaration area of the procedure?
    Thanks.
    Leandro.

    Thank you both. It compiled ok after granting the select privilege.
    However, I was able to execute a "select * from obus.order_tab" from a SQLPlus session, no matter if I had granted or not the SELECT privilege for that table.
    It seems the behaviour is different in a SQL session from a declaration in a procedure. Am I right? What could be the reason for this?
    Thanks.
    Leandro.

  • Declare custom type as %ROWTYPE variable in package

    I am creating a bunch of custom RECORD types in a package specification like so:
    CREATE OR REPLACE PACKAGE mypackage AS
    TYPE t1 IS RECORD (a number, b number);
    ...For consistency, I'd like to create a custom package type that uses a table %ROWTYPE, something like this:
    TYPE t2 IS RECORD (table%ROWTYPE);Is that possible in any way?
    Tom

    Hi Tom.
    You should read this: http://docs.oracle.com/cd/B10500_01/appdev.920/a96624/05_colls.htm
    "The attribute %ROWTYPE lets you declare a record that represents a row in a database table. However, you cannot specify the datatypes of fields in the record or declare fields of your own. The datatype RECORD lifts those restrictions and lets you define your own records."
    If you want to create a nested table of that records you can do this:
    DECLARE
       TYPE RecTab IS TABLE OF dept%ROWTYPE;
       dept_recs RecTab;
    ...If you just need a record this may help you.
    DECLARE
       dept_rec dept%ROWTYPE;
    ...Hope this helps.
    Regards.

  • Extension of  %ROWTYPE variable

    Hi all,
    Really scratching my head with this one and I'm sure there's a very simple solution.
    Reading values into a record which is based upon a system view called v$logmnr_contents
    input_rec v$logmnr_contents%ROWTYPE;
    I want an output_rec which is based upon this definition but has and extra column called IDX as the first column,
    this would be of type NUMBER.
    First question, is there a way to use the definition v$logmnr_contents but add this extra column?
    Along the lines of...
    Declare
    v_idx number;
    output_rec v_idx, v$logmnr_contents%ROWTYPE;
    Also how would I copy input_rec to output_rec without specifying the individual fields in the record?
    Hope somone has a solution.
    Regards
    Dave
    PS - This is Oracle 9i if that makes any difference.

    Thanks for all the replies.
    I've included the procedure below in case anyone else in the future needs to know how to do this.
    Thanks
    Dave
    CREATE OR REPLACE PROCEDURE "LOGMNR"."LOGMNR_DATA"
    (p_dict_filename VARCHAR2, p_arc_filename VARCHAR2)
    AS
    BEGIN
    DECLARE
    CURSOR
    c_logmnr_contents IS
    SELECT
    logmnr_sequence.nextval as IDX,
    V.*
    FROM
    V$LOGMNR_CONTENTS V
    WHERE
    v.sql_redo <> ' ' AND
    v.operation IN ('INSERT','UPDATE','DELETE'); -- Cursor based upon view v$logmnr_contents but with a sequence used as the first column.
    output_rec c_logmnr_contents%ROWTYPE; -- output_rec is mapped to the cursor return definition and is used to update the table.
    v_idx NUMBER := 0; -- Records read from View/Cursor
    BEGIN
    BEGIN
    dbms_output.put_line('Truncating materialised data');
    EXECUTE IMMEDIATE 'TRUNCATE TABLE logmnr.logmnr_contents'; -- Clean out the table which holds the materialised data.
    COMMIT;
    END;
    DBMS_LOGMNR.ADD_LOGFILE(LogFileName => p_arc_filename,
    Options =>dbms_logmnr.NEW);
    DBMS_LOGMNR.START_LOGMNR(DictFileName =>p_dict_filename,
    options => DBMS_LOGMNR.COMMITTED_DATA_ONLY);
    OPEN c_logmnr_contents;
    LOOP
    FETCH c_logmnr_contents INTO output_rec;
    EXIT WHEN c_logmnr_contents%NOTFOUND;
    v_idx := v_idx + 1;
    INSERT INTO logmnr_contents VALUES output_rec;
    END LOOP;
    CLOSE c_logmnr_contents;
    END;
    COMMIT;
    DBMS_LOGMNR.END_LOGMNR;
    END;

  • How to fetch %ROWTYPE OUT param of  a stored procedure from Java program?

    I have a stored procedure that has IN / OUT parameter as table_name%ROWTYPE.
    From a java program how can I access this ROWTYPE variable?
    I tried all possible documentation and none of the explains whether or not this is supported.
    My use case expect exactly 1 record from the procedure and we would prefer not to use REF CURSOR.
    Is there a way to achieve this? If so, can someone help me with it by posting the sample code to achieve this?
    I tried all the possible OracleTypes to register the OutParameter and they all fail.
    Looks like there isn't any equivalent of %ROWTYPE in OracleTypes either.
    If you need, I can post my sample procedure that uses %ROWTYPE as OUT parameter.
    I really appreciate your help in this regard.
    - Karthik

    Hi,
    If "returning only 1 record" the showstopper for not using Ref Cursor, you might want to reconsider because as you probably know, the ref cursor is only a pointer and requires additional step to retrieve the data.
    Kuassi

  • ORA 04067 %rowtype and "PUBLIC". does not exist

    Hi I have an error ORA-04067 for %rowtype in oracle 10g while running a form in turn it is calling a package. But the same thing is running fine with oracle 8i.
    Is there any code changes we need to made to upgrade to oracle 10g. Is that not backward compatable to cursors. procedure is using rowtype variables.
    can any one tell me the problem while migrating to oracle 10g from oracle 6i.
    Basically I am getting two errors I am not sure whether these two are realted or not.
    The error is Error code - 4067 and the Error - ORA 04067: not executed, Stored procedure "PUBLIC". does not exist.
    We have applied a patch to solve "PUBLIC" issue but form is still not working.
    procedure GetInventory
    (p_inventory_rec in out INVENTORY%ROWTYPE,
    p_lock BOOLEAN,
    p_found out boolean,
    p_locked out boolean) is
    I will really appreciate your help.
    Thanks
    Sandy

    Perhaps this link can give you some basic idea - i guess ->
    db function throws ORA-04067 Procedure does not exist error in forms
    Regards.
    Satyaki De.

  • Using ROWTYPE to create undoable record

    Does anyone have any insight on how I would perform the following in forms:
    Define a %ROWTYPE record
    On Each Navigation to a new Record
    Store all the record's values in %ROWTYPE variable
    An UNDO button on the form would then revert all the values in the current record to the values stored in the %ROWTYPE variable.
    I am new to this, I can't even seem to figure out how to define the %ROWTYPE variable, much less populate and revert the form's contents.
    Thanks for your help.
    MS
    null

    1. Put a trigger on the table that populates the pk with the sequence
    2. Change your procedure "PROMOTE" into a function that returns the new id
    3. In your function code, use the "returning ... into" clause of an insert statement to get the new id:
    create or replace function promote(
      p_early_proj_id in number)
    return number
    is
      l_new_id number;
    begin
      insert into late_project (a,b,c) values (...) returning id into l_new_id;
      return l_new_id;
    end promote;4. Call your function from a PL/SQL process like this:
    :P8_NEW_LATE_PROJ_ID := PROMOTE(p_early_proj_id) ;This technique will also allow you to call this function from technologies other than APEX, instead of burning part of the logic into the APEX code itself.
    Tyler

  • X-file with db function returning a rowtype to forms. Positional binding?

    How to explain this ...
    First things first:
    Forms [32 bits] Versión 11.1.2.1.0 (Producción)
    Oracle Database 11g Release 11.2.0.3.0 - 64bit Production
    Now the db testcase:
    I've got two schemas, quite similar, SCHEMA_A and SCHEMA_B
    Imagine the same table: mytable (colx varchar2, coly varchar2, colz varchar2) in both schemas,
    BUT in SCHEMA_B the order of the cols is not the same. In schema B it is
    mytable (colx, colz, coly).
    (Yeah, I know, I know, but leave it for the sake of the x-file)
    Let's suppose the table has only one row, and that I have a db function in both schemas such as this:
    function get_myrow return mytable%rowtype is
    l_row mytable%rowtype;
    begin
    select * into l_row from mytable;
    return l_row;
    end;
    Here, the forms testcase:
    I make a form, where I show the value in an item
    For example:
    :item := get_myrow().coly
    And now, the x-file:
    If I compile the form in the builder, connected as SCHEMA_A, when I run it in SCHEMA_B, the item shows colz value!!
    It is as if forms is doing some kind of positional binding in the fmx. Instead of asking for coly column to the record type variable, it shows "the second value" of the record type.
    Now, I will have to find this disordered tables and reorder them (dbms_redefinition? hints are welcome).
    Any thougts? Bug as feature?

    About the "select * is problematic" , I agree 99% of the times. But this time, as I'm storing the values in the rowtype variable, is the way to ensure that the estructure and the values fit.
    You said:
    What happens when your table changes (such as a new column) but your function hasn't been updated?  Your Function will produce an error because it can't handle the additional column.
    And it's just the opposite. My function will recompile itself, as the rowtype is perfectly capable of storing the values in the new rowtype.
    In fact, it's the MLBrown function the one that would produce an error if I change columns in the table, and that's the best case scenario, as the function could be lucky and work storing the values in the wrong places, leaving the bug hidden.
    Anyway, I understand this "select *" issue is arguable, so forget about the select * , I'll take it out of this thread with a more simple testcase:
    create table mytable (
    colx varchar2(10),
    coly varchar2(10),
    colz varchar2(10));
    Consider this "select free" version of the function:
    function get_myrow return mytable%rowtype is
      l_row mytable%rowtype;
    begin
    l_row.colx := 'a';
    l_row.coly := 'b';
    l_row.colz := 'c';
      return l_row;
    end;
    Forget also about schema_a and schema_b, I can reproduce it with just one schema!!!
    Now I build a form with just a button. When- button-pressed:
    message (get_myrow.coly);
    I compile and run it, and I get a b value. ok.
    Now I drop the table and recreate but like this:
    create table mytable (
    colx varchar2(10),
    colz varchar2(10),
    coly varchar2(10));
    Now run the form (without compiling) and see how the message shown is c !!!
    The result is different, depending on how whas the rowtype structure when I compiled the fmb.
    Are you indeed telling that is acceptable an escenary where I ask for get_myrow().coly value and I get colz value instead?
    How's that possible? Because somebody shortcutted in the fmx compiling process, and converted my call for named coly value to a call to "the second column of the record variable".
    I'm not asking for a numbered position , I'm asking for coly value, not for "the second column of the rowtype variable the day I compiled the form". Had I want a possitional binding, I'd use a frikkin varray.

  • Passing a generic rowtype, convert to XML

    We're currently storing some data in a XMLType column. For the originally intended purpose, we had access to a dynamic SQL statement, via a refcursor and so we've been able to use DBMS_SQL to retrieve column names from those SQL statements. Then we convert that into XML and store it in the XMLType column.
    Now we're considering letting other processes use this code, but they'll be working off of a different mechanism which generates their own SQL statements. But we were looking for a generic mechanism to build the same XML data from, best case scenario, a ROWTYPE variable. But everything I've read tells me I at least need a SQL statement (refcursor included) in order to have access to the elements on the row. And I'm trying to steer clear of passing in the SQL statement, since some of this calling code is working off of cursor for loops.
    We're trying to ultimately build something like:
    create function BUILD_XML (p_generic_rowtype SYSROWTYPE) return varchar2
    as
      for each column in p_generic_rowtype
      loop
        build_another_line_of_xml_code;  
      end loop;
      return xml;
    end;
    We know the myriad of calling programs will have a ROWTYPE variable available, but we won't know anything about it. I
    've also thought about building something where a name-value paired collection is passed in, but I still think that's going to require something more manual on the calling program's end. Mostly I'm just trying to see if there's a concise way to get this working, or if we would need to either pass in a SQL stmt or customize the calling code every time.
    --=Chuck

    Have you considered using a standard 'generic' column type and a fixed number of columns? That is what Oracle uses for DML error logging tables
    EXEC DBMS_ERRLOG.CREATE_ERROR_LOG ('EMP')
    SELECT DBMS_METADATA.GET_DDL('TABLE', 'ERR$_EMP', 'SCOTT') FROM DUAL
    CREATE TABLE "SCOTT"."ERR$_EMP"
    ( "ORA_ERR_NUMBER$" NUMBER,
    "ORA_ERR_MESG$" VARCHAR2(2000),
    "ORA_ERR_ROWID$" UROWID (4000),
    "ORA_ERR_OPTYP$" VARCHAR2(2),
    "ORA_ERR_TAG$" VARCHAR2(2000),
    "EMPNO" VARCHAR2(4000),
    "ENAME" VARCHAR2(4000),
    "JOB" VARCHAR2(4000),
    "MGR" VARCHAR2(4000),
    "HIREDATE" VARCHAR2(4000),
    "SAL" VARCHAR2(4000),
    "COMM" VARCHAR2(4000),
    "DEPTNO" VARCHAR2(4000)
    Every column is a VARCHAR2(4000). You could use a standard column naming convention and then use a %ROWTYPE on the table (or on a view).
    Since your use case is email everything needs to be converted to test anyway so could easily be stored in such a table.

  • Dynamically passing %rowtype

    I've built an update row trigger on several tables. The purpose is to capture the old and new values in variables then passing these values to a package containing MANY functions/procedures that validate the data. Each table is structured differently. I've got about 183 tables that need to have this trigger applied to it.
    Anyway, the workaround I've found for the first few tables is to overload the procedures in the package and pass in the literal table_name%rowtype (ex. emp%rowtype). This is at best a cumbersome solution because of the number of tables that will eventually be passed.
    I've tried the following:
    1) dynamically building the %rowtype variable then passing that variable (on compile I get an error saying table_name must be a table)
    2) creating a global temporary table in a separate procedure using pragma autonomous transaction (when I run the update I get an ORA-03031 error because the user has insufficient priveliges. We want to assign priveliges by roles not by individuals, so this option doesn't work for us.)
    3) create a cursor by inserting the new/old values into the cursor. (seems that we have to do a select statement to create the cursor then fetch records from the cursor into a variable. We really just want the table structure, not the data. Then we want to insert the values from the :old & :new values).
    4) Our DBA doesn't like varrays, nested tables, or object types so that doesn't seem to be an option.
    I know these triggers must be done all of the time, but I can't figure out how to do it.
    tia, robin

    Thanks for your response Nilanjan. I am doing exactly same thing but facing an issue. I am concatenating the LOCATIONS base members (retrieved using 2nd EVDRE) and referencing the cell with the concatenation value to the memberset of the ACCOUNT dimension (Location = cell reference). It works fine the first time but the moment I select a different LOCATION hierarchy in the control view, the formula is disturbed because the cell references change. For example: when I select H1, I have Japan and India as the first 2 members in the Row key of the 2nd EVDRE( LOCATION one). I get these row key range values in separate cells. And I pass these cell references in the Concatenation formula. But when I select a different hierarchy H2 and say in the second hierarchy India is at 7th position, then it does not work as the cell that had reference to the second row key range (with India value) still has India value instead of the 2nd value in the new hierachy which is say England i.e. the cell does not take value by reference. If you have any solution to this problem, please let me know. You help is much appreciated.
    Thanks
    Rahul

  • Declaring variable using Dynamic SQL

    Hi guys,
    I need to declare a variable base on a result.
    <snipplet>
    DECLARE
    v_objname VARCHAR2(50);
    BEGIN
    SELECT OBJECT_NAME
    INTO v_objname
    FROM USER_OBJECTS
    WHERE OBJECT_ID = 'xxx'
    AND OBJECt_TYPE = 'TABLE';
    -- now i need to declare a rowtype variable base on the objname
    -- e.g v_rowname v_objname%ROWTYPE;
    </snipplet>
    q1) May i know how do i do that ?
    Regards,
    Noob

    This sounds like a precursor to building a "generic" piece of code. As Boneist says... Bad Idea.
    If dynamically generated queries really need to be written (justify why first!) and you're not sure of the columns that are going to be returned, then you would preferably use the DBMS_SQL package to build the query and use positional notation to obtain the data from the dynamic columns, using the describe ability of dbms_sql to get information on the column types etc.
    e.g.
    (From my standard answers...)
    As sys user:
    CREATE OR REPLACE DIRECTORY TEST_DIR AS '\tmp\myfiles'
    GRANT READ, WRITE ON DIRECTORY TEST_DIR TO myuser
    /As myuser:
    CREATE OR REPLACE PROCEDURE run_query(p_sql IN VARCHAR2
                                         ,p_dir IN VARCHAR2
                                         ,p_header_file IN VARCHAR2
                                         ,p_data_file IN VARCHAR2 := NULL) IS
      v_finaltxt  VARCHAR2(4000);
      v_v_val     VARCHAR2(4000);
      v_n_val     NUMBER;
      v_d_val     DATE;
      v_ret       NUMBER;
      c           NUMBER;
      d           NUMBER;
      col_cnt     INTEGER;
      f           BOOLEAN;
      rec_tab     DBMS_SQL.DESC_TAB;
      col_num     NUMBER;
      v_fh        UTL_FILE.FILE_TYPE;
      v_samefile  BOOLEAN := (NVL(p_data_file,p_header_file) = p_header_file);
    BEGIN
      c := DBMS_SQL.OPEN_CURSOR;
      DBMS_SQL.PARSE(c, p_sql, DBMS_SQL.NATIVE);
      d := DBMS_SQL.EXECUTE(c);
      DBMS_SQL.DESCRIBE_COLUMNS(c, col_cnt, rec_tab);
      FOR j in 1..col_cnt
      LOOP
        CASE rec_tab(j).col_type
          WHEN 1 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000);
          WHEN 2 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_n_val);
          WHEN 12 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_d_val);
        ELSE
          DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000);
        END CASE;
      END LOOP;
      -- This part outputs the HEADER
      v_fh := UTL_FILE.FOPEN(upper(p_dir),p_header_file,'w',32767);
      FOR j in 1..col_cnt
      LOOP
        v_finaltxt := ltrim(v_finaltxt||','||lower(rec_tab(j).col_name),',');
      END LOOP;
      --  DBMS_OUTPUT.PUT_LINE(v_finaltxt);
      UTL_FILE.PUT_LINE(v_fh, v_finaltxt);
      IF NOT v_samefile THEN
        UTL_FILE.FCLOSE(v_fh);
      END IF;
      -- This part outputs the DATA
      IF NOT v_samefile THEN
        v_fh := UTL_FILE.FOPEN(upper(p_dir),p_data_file,'w',32767);
      END IF;
      LOOP
        v_ret := DBMS_SQL.FETCH_ROWS(c);
        EXIT WHEN v_ret = 0;
        v_finaltxt := NULL;
        FOR j in 1..col_cnt
        LOOP
          CASE rec_tab(j).col_type
            WHEN 1 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_v_val);
                        v_finaltxt := ltrim(v_finaltxt||',"'||v_v_val||'"',',');
            WHEN 2 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_n_val);
                        v_finaltxt := ltrim(v_finaltxt||','||v_n_val,',');
            WHEN 12 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_d_val);
                        v_finaltxt := ltrim(v_finaltxt||','||to_char(v_d_val,'DD/MM/YYYY HH24:MI:SS'),',');
          ELSE
            v_finaltxt := ltrim(v_finaltxt||',"'||v_v_val||'"',',');
          END CASE;
        END LOOP;
      --  DBMS_OUTPUT.PUT_LINE(v_finaltxt);
        UTL_FILE.PUT_LINE(v_fh, v_finaltxt);
      END LOOP;
      UTL_FILE.FCLOSE(v_fh);
      DBMS_SQL.CLOSE_CURSOR(c);
    END;This allows for the header row and the data to be written to seperate files if required.
    e.g.
    SQL> exec run_query('select * from emp','TEST_DIR','output.txt');
    PL/SQL procedure successfully completed.Output.txt file contains:
    empno,ename,job,mgr,hiredate,sal,comm,deptno
    7369,"SMITH","CLERK",7902,17/12/1980 00:00:00,800,,20
    7499,"ALLEN","SALESMAN",7698,20/02/1981 00:00:00,1600,300,30
    7521,"WARD","SALESMAN",7698,22/02/1981 00:00:00,1250,500,30
    7566,"JONES","MANAGER",7839,02/04/1981 00:00:00,2975,,20
    7654,"MARTIN","SALESMAN",7698,28/09/1981 00:00:00,1250,1400,30
    7698,"BLAKE","MANAGER",7839,01/05/1981 00:00:00,2850,,30
    7782,"CLARK","MANAGER",7839,09/06/1981 00:00:00,2450,,10
    7788,"SCOTT","ANALYST",7566,19/04/1987 00:00:00,3000,,20
    7839,"KING","PRESIDENT",,17/11/1981 00:00:00,5000,,10
    7844,"TURNER","SALESMAN",7698,08/09/1981 00:00:00,1500,0,30
    7876,"ADAMS","CLERK",7788,23/05/1987 00:00:00,1100,,20
    7900,"JAMES","CLERK",7698,03/12/1981 00:00:00,950,,30
    7902,"FORD","ANALYST",7566,03/12/1981 00:00:00,3000,,20
    7934,"MILLER","CLERK",7782,23/01/1982 00:00:00,1300,,10The procedure allows for the header and data to go to seperate files if required. Just specifying the "header" filename will put the header and data in the one file.
    Adapt to output different datatypes and styles are required.
    I have never found any need, ever* to have to write dynamic PL/SQL code. It just shouldn't be necessary. If you're finding yourself heading in that direction, seriously take a step back and re-consider your design and what it actually is you're trying to achieve. There almost always will be a better way.

  • Pass rowtype as function parameter, as a Object like type. How?

    Hi.
    I have the following question.
    I have 3 tables:
    TAB1
    TAB2
    TAB3
    I declare 3 rowtypes variables, one for each table:
    v_tab1 TAB1%ROWTYPE;
    v_tab2 TAB2%ROWTYPE;
    v_tab3 TAB3%ROWTYPE;
    I want to pass a rowtype as a function parameter, but i want the function to allow any rowtype to be passed as parameter, and then inside the function convert that "object" to the correct rowtype.
    Is that possible?
    In another language like C# for example, i would pass the rowtype as a object type, and then cast it to the correct data type.
    I hope you can help me.
    Cheers.

    To do this they would have to be object types, and have a common supertype.Alternatively unrelated object types could be abstracted away with ANYDATA.
    There is no such functionality exposed / documented for records - although the signatures of several built-in packages suggest that a mechanism for passing ADTs as formal parameters does actually exist.

Maybe you are looking for