PL/SQL Record variables

I have a table 'emp' in the database. In my PL/SQL procedure, I define a record variable to be of same type as 'emp' table, like this;
emp_rec emp%rowtype;
Now I can use this record variable to read a whole record from emp table;
select * into emp_rec from emp where ....
Now I want to know can i use this record variable the same way in insert statements like this;
insert into emp values (emp_rec) .
also, what about update statement (like update emp set *=emp_rec.* where ...)?
Thnaks in avdvance.

Normally the SQL Reference would tell you all there is to know about INSERT or UPDATE syntax, but this extra feature happens to be available in PL/SQL only and so it is documented in the PL/SQL Reference.
It is mentioned in Feuerstein's "Oracle PL/SQL Programming", 3rd edition.

Similar Messages

  • Pass PL/SQL Record variable to Stored procedure in Java

    Can some one please give me a code snippet for passing a Record Type variable returned by Stored Procedure. Following is the scenario.
    A record type variable REC_VAR is made of three columns of a table as follows
    EmpNo Number, Empname Varchar2(50), Zip_Code Varchar2(5).
    I am populating this variable in Java code and passing it to Stored Procedure.
    Can I referance Record Type variable in a Oracle package from Java code.
    How would I define these variables as per table’s column type and pass to SP in a java program.
    Thanks,

    58838,
    The following entry -- from the Ask Tom Web site may be helpful (assuming you haven't already seen it):
    how to access variable
    If it doesn't help, you can always search the site.
    Good Luck,
    Avi.

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

  • SQL environment variable into a local variable in stored procedure ?

    How do i set a SQL environment variable in a session ? How can i read an SQL environment variable into a local variable declared in my stored procedure ? Does any exceptions occur in the process ?
    I need this very urgently, can anyone help ?
    thanks
    srini

    You can use a pipelined table function to return it, which is covered here:
    http://blog.mclaughlinsoftware.com/plsql-programming/pipelined-functions-plsql-tables/
    Alternatively, you can use a SQL Object type wrapped by a collection of that SQL object type inside a TABLE call. I've blogged on that too, here:
    http://blog.mclaughlinsoftware.com/2009/03/23/object-record-collections/
    If you need something more, leave a comment on the blog. I'm not here on the forum too frequently. Hope that helped.

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

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

  • Return rows from pl-sql record type

    We have a requirement to create function which returns cursor to java application. This cursor will have data from pl-sql record type.
    Tried with pipelined function. I have written code below.
    CREATE or replace PACKAGE test_pkg IS
        TYPE tp_rec IS RECORD(tt_id INTEGER,tt_text VARCHAR2(40));
        TYPE obj_tp_recs IS TABLE OF tp_rec;
        TYPE obj_tp_recs1 IS TABLE OF tp_rec;
        FUNCTION test_func RETURN tp_rec;
        function type_out return obj_tp_recs1 PIPELINED;
        PROCEDURE test_type (result out sys_refcursor);
    END;
    CREATE OR REPLACE PACKAGE BODY OMS.test_pkg IS
        FUNCTION test_func RETURN tp_rec
        AS
           currec tp_rec;
        BEGIN
           currec.tt_id := 1;
           currec.tt_text := 'test1';
        END;
         FUNCTION type_out RETURN obj_tp_recs1 PIPELINED
             AS
           currec1 test_pkg.tp_rec;
          begin
                    currec1 := test_pkg.test_func;
                    PIPE ROW(currec1);
                    dbms_output.put_line(currec1.tt_id);
                end;
        PROCEDURE test_type (result out sys_refcursor)
        AS   
        BEGIN
                  OPEN RESULT
                  FOR SELECT * FROM TABLE(test_pkg.type_out());
        END;
    END;
    SQL> VARIABLE x REFCURSOR
    SQL> exec test_pkg.test_type(:x);
    PL/SQL procedure successfully completed.
    SQL> print xThis code returns no data found exeception from function. How to achieve result 1 and test1 from above code?
    Thanks in advance

    SQL> VARIABLE x REFCURSOR
    SQL> exec test_pkg.test_type(:x);
    PL/SQL procedure successfully completed.
    SQL> print x
    ERROR:
    ORA-06503: PL/SQL: Function returned without value
    ORA-06512: at "SCOTT.TEST_PKG", line 8
    ORA-06512: at "SCOTT.TEST_PKG", line 14
    no rows selectedIf you look at test_func body it is missing return statement. Now:
    SQL> CREATE OR REPLACE PACKAGE BODY test_pkg IS
      2      FUNCTION test_func RETURN tp_rec
      3      AS
      4         currec tp_rec;
      5      BEGIN
      6         currec.tt_id := 1;
      7         currec.tt_text := 'test1';
      8         RETURN currec;
      9      END;
    10     
    11       FUNCTION type_out RETURN obj_tp_recs1 PIPELINED
    12       AS
    13         currec1 test_pkg.tp_rec;
    14        begin
    15          currec1 := test_pkg.test_func;
    16          PIPE ROW(currec1);
    17          dbms_output.put_line(currec1.tt_id);
    18          end;
    19  
    20      PROCEDURE test_type (result out sys_refcursor)
    21      AS   
    22      BEGIN
    23        OPEN RESULT
    24        FOR SELECT * FROM TABLE(test_pkg.type_out());
    25       
    26      END;
    27  END;
    28  /
    Package body created.
    SQL> exec test_pkg.test_type(:x);
    PL/SQL procedure successfully completed.
    SQL> print x
         TT_ID TT_TEXT
             1 test1
    SQL> SY.

  • Dynamically assigning to PL/SQL Record

    I want to write a procedure to which i pass the the pl/sql record, field name and the value,
    and the Assignment to the field in pl/sql record is done dynamically.
    Thanks,
    null

    Name of the record variable is not required to assign value it it. When you declare the procedure, declare the parameter as INOUT. You can assign value the parameter directly whic will in turn affect the original record you passed in!
    Let me know if this solved your problem.

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

  • Report cannot access pl/sql table variable defined in Package Spec.

    Hi,
    I've created a package spec called pkg_report with a PL/SQL table variable defined called body_text_table. When I tried to compile the following code under the Before Report trigger:
    :desc := pkg_report.body_text_table(1);
    Oracle gave me the following error:
    Implementation Restriction: 'PKG_REPORT.BODY_TEXT_TABLE': Cannot directly access remote package variable or cursor.
    Does anyone have any idea about this error? Thank you for your time at looking at it.
    Regards,
    John

    You cannot directly access the package variable in a database package. The work around is to create a set_variable and get_variable wrapper function in the package body. See Metalink note 105838.1 for more info.
    A simple example:
    create or replace package my_package as
      my_var     number;
      function   get_variable return number ;
      procedure  set_variable (p_value in number) ;
    end ;
    create or replace package body my_package as
      function get_variable return number is
      begin
        return my_var;
      end ;
      procedure set_variable(p_value in number) is
      begin
        my_var := p_value ;
      end ;
    end;

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

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

  • 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

  • Create record variable that refers dynamic query assigned to a ref cursor?

    Hi ,
    Just explaining what I am trying to achieve:
    1) i have a hr.departments table that was loaded in hr schema on 1st oct 2012 with 4 columns(department_id, department_name, manager_id, location_id)
    2) now I have a new schema by my name 'rahul' and I have loaded departments table but now an additional column has come into picture,ie created_date, this table got loaded on 1st-Nov-2012
    3) Now going forward my columns could be dropped from the departments table (it can be a case), for example might be my departments table in my schema 'rahul' one day could comprise of only 3 columns(department_id,department_name,manager_id)
    4) Now in the next step, I have managed to extract common column names(in a single line where columns are delimited using a comma) from both the tables(hr.departments and rahul.departments) which are (department_id, department_name, manager_id, location_id) using all_tab_cols table and I have written a function for it which i will be pasting below.
    5) now going forward, using the above column names line with column names delimited using comma, I have used a ref cursor and assigned a query to it using the line of columns that I have extracted from the above point
    6) Now I want to create a record variable which refers to my ref cursor, something like we do when we create a record variable by reffering to an explicit cursor defination that we give in the declaration block.
    PS:
    1) I have been out of touch with plsql for a long time so I have lost a lot of mmeory regarding plsql.
    2) basically I need to compare data in hr.departments table with rahul.departments table for only columns that are common to both the tables, rest new or discarded columns information will go in one of the log tables that I have created(this is done already)
    Please help me, I did try searching on google for the same but it really confused me very badly, any kind of help is appreciated, please find my code below:
    Regards
    Rahul
    Code :
    ===================================================================================================
    create or replace procedure p_compare_data(fp_old_table_name in varchar2, fp_new_table_name in varchar2)
    is
    type ref_cursor_old_table is ref cursor;
    v_ref_cursor_old_table ref_cursor_old_table;
    --record_v_ref_cursor_old_table v_ref_cursor_old_table;
    --record_ref_cursor_old_table v_ref_cursor_old_table%ROWTYPE;
    Lv_all_column_names varchar2(2000);
    function f_fetch_common_column_names(fp_old_table_name in varchar2, fp_new_table_name in varchar2)
    return varchar2
    is
              Lv_all_column_names varchar2(2000);
    begin
              execute immediate 'select ltrim(all_column_names,'','') all_column_names_in_line from (select * from (select sys_connect_by_path(hr_e_column_name,'','') all_column_names from (select hr_e_column_name, rownum curr, rownum - 1 prev from (select hr_e.* , rahul_e.* , case when (hr_e_column_name = rahul_e_column_name) then 1 when (rahul_e_column_name is NULL) then 2 when (hr_e_column_name is NULL) then 3 end decision from (select column_name hr_e_column_name from all_tab_cols where owner ='''||substr(fp_old_table_name,1,instr(fp_old_table_name,'.',1,1)-1)||''' and table_name = '''||substr(fp_old_table_name,instr(fp_old_table_name,'.',1,1)+1)||''') hr_e full outer join (select column_name rahul_e_column_name from all_tab_cols where owner = '''||substr(fp_new_table_name,1,instr(fp_new_table_name,'.',1,1)-1)||''' and table_name = '''||substr(fp_new_table_name,instr(fp_new_table_name,'.',1,1)+1)||''') rahul_e on hr_e.hr_e_column_name = rahul_e.rahul_e_column_name) decision_table where decision = 1) a start with a.curr = 1 connect by prior curr = prev) b order by length(b.all_column_names) desc) all_column_names_in_line where rownum = 1' into Lv_all_column_names;
              return (Lv_all_column_names);
    end;
    begin
         Lv_all_column_names := f_fetch_common_column_names(fp_old_table_name, fp_new_table_name);
         --dbms_output.put_line(Lv_all_column_names);
         open v_ref_cursor_old_table for ('select '||Lv_all_column_names||' from '||fp_old_table_name);
    end;
    =====================================================================================================

    >
    6) Now I want to create a record variable which refers to my ref cursor, something like we do when we create a record variable by reffering to an explicit cursor defination that we give in the declaration block.
    >
    This thread is basically nothing more than a continuation of your original thread except now you are finally explaining what you are really trying to do.
    Re: passing table name to a procedure and then need to open a cursor ..
    In that original thread you said you found the solution
    >
    Well Mate thanks for your suggestion but I got it working through ref cusror, thanks for your time.
    >
    So I ask you to post your 'solution' and when you finally did it was clear that you hadn't solved anything at all. Your solution used a ref cursor all right but the code relied on a record ('record_employees') that was based on a table name ('employees') that was declared within the procedure. There isn't much point in passing in a table name if you have to hard-code the table name in the procedure.
    create or replace procedure p_ref_cursor(fp_old_table in varchar2)
    is
    type ref_cursor is REF CURSOR;
    v_ref_cursor ref_cursor;
    record_employees hr.employees%ROWTYPE;
    begin
    open v_ref_cursor for 'select * from '||fp_old_table;
    loop
    fetch v_ref_cursor into record_employees;
    exit when v_ref_cursor%NOTFOUND;
    dbms_output.put_line(record_employees.employee_id);
    end loop;
    end;Then sb92075 ask you the question that illustrates what I just said
    >
    what happens when you pass in "HR.DEPARTMENTS" ; besides throwing errors?
    >
    And you blew him off with this
    >
    Mate, departments never came in my context, in my prior message I explained what I was trying to achieve ... so I dont know what problem you are understanding reading my posts.
    >
    And now here you are asking how to get this to work for the departments table.
    It is very difficult to help someone that won't tell us what it is they are really trying to do so we can try to suggest some better ways of doing it. Hopefully, in the future, you wil start by explaining your problems instead of focusing on the solution you think you should use.
    Back to the issue -
    The first thing you should do is finish defining the requirements. Assuming the above actually works to identify columns that have different data what are you going to do with that information?
    1. Do you need to save that different data from TABLE1 somewhere?
    2. If you don't save it how will anyone look at it to decide which table has the correct data?
    3. If you do save it how will you save it 'generically' since other tables will have different columns and datatypes?
    4. What about the data from the same record in TABLE2; do you need to save that data somewhere?
    5. Will these two tables have primary keys? Are they on the same columns in each table? If not what if TABLE1 has one record but there are TWO records in TABLE2 that are identical. Is that a match? Or is that a problem because TABLE2 has an extra record even though the record is identical?
    In short detecting the differences is just one small part of the entire problem. You also need to save those differences somewhere so someone can examine the data and decide what action to take. That is the more difficult part of trying to implement a 'generic' solution.
    But now that we know what you are really trying to do take a read through this thread from 6 years ago. It has three different ways to pass a query to a procedure and get different output. You may want to save a copy of the thread since it has some very advanced techniques in it.
    How to pipeline a function with a dynamic number of columns?
    See ascheffer's reply Posted: May 9, 2006 4:53 AM for using data cartridge functionality with a pipelined function.
    See Kamal's reply Posted: May 10, 2006 4:49 AM - it shows how to get XML output.
    See BluShadow's reply Posted: Mar 27, 2009 1:50 AM - for using dynamic sql

Maybe you are looking for

  • Install 16 bit Oracle client on Win 2003 server

    Hello, Is it possible to install Oracle SQL* Net 2.3(16 bit) Client on Windows 2003 server. If it is then could someone give me links from where I could get more information on this (like the steps to install 16 bit Oracle client on Win 2003). Thanks

  • Install fails because file missing from AppleMobileDeviceSupport.cab file

    I have iTunes on my Desktop PC and my wife's laptop, both running Windows 7 x64 Ultimate.  Automatic iTunes update failed on both with same error.  On trying to manually install latest iTunes downloaded from Apple UK website I get the following error

  • "iTunes has stopped working" after i upgraded to iTunes 8

    My itunes does not open anymore. when i turn on my computer, theres a pop-up message saying "ituneshelpermodule" has stopped working and when i open itunes, it pops up with a message saying "itunes has stopped working". I am running windows vista and

  • Problem with WSA demo license

    When a do this: https://tools.cisco.com/SWIFT/LicensingUI/Quickstart#. -> Get Other License-> Demo and Evaluation-> Security Products-> Cisco Virtual Appliance Demo License->Cisco Web Security Appliance (WSA) Virtual Appliance 45 Days Demo License I

  • Improve reports! (Parameter Grid .... to develop.....)

    Hi, I've been messing around the parameter grid in paper conception mode to realise that you cannot place an image in there... why? I've copied one from report paper layout and it went through. It's just its properties were torned out to 'TEXT' and i