Doubt PLSQL cursor table variable record

Hi all

My version of Oracle: Oracle 10 G

I have a cursor, allows day:

cursor c_emp
is
(select * from emp where empina = 10); -Now this * returns me 5 values, IE empid (100), (rahul) fname, lname (smith), sal (9000), deptid (10)

Now, in my home, I have a cursor loop for example, like this:

Start
for rec_c_emp in c_emp
loop
..
..
..
end of loop
end;

Now my requirement is I need to capture these values(rec_c_emp.empid,rec_c_emp.fname,rec_c_emp.lname,rec_c_emp.sal,rec_c_emp.deptid) 5
in a table that is to say i [0], I [1], I [2], I [3], I [4]

Now please note that in the future my ' select * from emp' could make me more values and so I need to capture these values without changing my code.

I hope that I clearly explained my problem, please help.

Concerning
Rahul

Mac_Freak_Rahul wrote:

Let's say I have a cursor:

cursor c_emp is
Select to_char (empid) empid, fname to_char (fname), lname to_char (lname), to_char (sal) sal to_char (deptid) deptid from emp where empno = 100;

want these values to be assigned to my table of varchar2, as:
a [0]: 100
[1]: rahul
[2]: smith
[3]: 9000
[4]: 10

Possible - but not really reasonable.

The projection of SQL itself must be a single table. For example

SQL> create or replace type TArray is table of varchar2(4000);
  2  /

Type created.

SQL>
SQL> col ARRAY format a50
SQL> select TArray(empno,ename,job,sal) as ARRAY from emp order by empno;

ARRAY
--------------------------------------------------
TARRAY('7369', 'SMITH', 'CLERK', '800')
TARRAY('7499', 'ALLEN', 'SALESMAN', '1600')
TARRAY('7521', 'WARD', 'SALESMAN', '1250')
TARRAY('7566', 'JONES', 'MANAGER', '2975')
TARRAY('7654', 'MARTIN', 'SALESMAN', '1250')
TARRAY('7698', 'BLAKE', 'MANAGER', '2850')
TARRAY('7782', 'CLARK', 'MANAGER', '2450')
TARRAY('7788', 'SCOTT', 'ANALYST', '3000')
TARRAY('7839', 'KING', 'PRESIDENT', '5000')
TARRAY('7844', 'TURNER', 'SALESMAN', '1500')
TARRAY('7876', 'ADAMS', 'CLERK', '1100')
TARRAY('7900', 'JAMES', 'CLERK', '950')
TARRAY('7902', 'FORD', 'ANALYST', '3000')
TARRAY('7934', 'MILLER', 'CLERK', '1300')

14 rows selected.

SQL>
SQL> begin
  2          for c in(
  3                  select TArray(empno,ename,job,sal) as array from emp where rownum < 3
  4          ) loop
  5                  DBMS_OUTPUT.put_line( 'ROW' );
  6                  for i in 1..c.Array.Count loop
  7                          DBMS_OUTPUT.put_line( 'array['||i||']='||c.Array(i) );
  8                  end loop;
  9          end loop;
 10  end;
 11  /
ROW
array[1]=7369
array[2]=SMITH
array[3]=CLERK
array[4]=800
ROW
array[1]=7499
array[2]=ALLEN
array[3]=SALESMAN
array[4]=1600

PL/SQL procedure successfully completed.

SQL>

Tags: Database

Similar Questions

  • How to perform procedures with REF CURSOR &amp; PLSQL settings table in SQL Dev?

    I have 3 SQL Developer. I create a procedure with a set of tables/PL/SQL as an input parameter and a SYS_REFCURSOR as output parameter.

    When I press the green arrow (Run button) block the dialog box run PL/SQL PL/SQL has no place at the PL/SQL table with records of entry and also to see the output of the SYS_REFCURSOR.

    I get the error ORA-06550 and many other errors when I run the present.

    How to do this please?

    In the debug code, lose the ABS. Prefix the SYS_REFCURSOR QC_SQL_DEVELOPER_TEST.
    Also, do not use same name of your settings on your bind variable (so e.g.: OUT_REF_CURSOR).
    REF CURSOR is supported output types, so you will get the output of their share in the output tab.
    However the output system does not recognize your own types as your PL/SQL table. You need to write an exit procedure yourself, indexing correctly, using the DBMS_OUTPUT.

    Have fun
    K.

  • Can I return a record/table of records of proceedings aside Java Server?

    I need to get data from a remote service during the execution of a PL/SQL procedure. The first of these calls returns a table, each entry that consists of a number of channels, but the second Gets a master-detail structure, a parent row, and an arbitrary number of records of invoice line.

    Just to make it interesting the PL/SQL must operate on an existing 8i database, which means that I have to encode any Java JDK 1.1.8 (which should be about 1990 vintage).

    The natural way to do this would be to code a java procedure that return an array of records. Unfortunately, I understand that you cannot return a record of PL/SQL returned by a call to jdbc, which suggests that there may be no class in Java or Jave to manage server-side. There is certainly no record type in oracle.sql. *;

    Is it possible to return a record or a table of records or as a return value or OUT of a java PL/SQL function procedure parameter and, if not, what is the best way to return data that can be structured in the PL/SQL code?

    Oracle 8i shouldn't be so bad - you should still have nested table types, and the ability to use a collection in a select... TABLE... MOUNT the statement and return a refcursor, for example - without doubt the best way to return a set of information from a java client.

    However, you can map collections of Oracle to Java arrays using oracle.sql.STRUCT, oracle.sql.ARRAY, oracle.sql.StructDescriptor and oracle.sql.ArrayDescriptor - are they available in the JDK?

    Oracle 8.1.7 documentation is always available online:
    http://Tahiti.Oracle.com/pls/Tahiti/Tahiti.homepage

    See also the Oracle8i - object-relational features applications developer's Guide
    http://download.Oracle.com/docs/CD/A87860_01/doc/AppDev.817/a76976/TOC.htm

    Published by: Dom Brooks on March 8, 2011 11:06

  • Open sys_refcursor to select from the table variable?

    Hello

    I have a challenge for you! :-)

    I have a procedure that has a lot of logic to determine which data should be loaded into a table variable. Because of various constraints of the application, I can't create a global temporary table. Instead, I would like to create a table variable and fill with stuff that I go through the procedure.

    The final outcome of the procedure is that I must be able to pass the results as a sys_refcursor. It is a requirement that is beyond my control as well.

    Is there a way to do this kind of work of the procedure?

    Create Or Replace procedure Xtst
    (
    Mu_Cur in the Sys_Refcursor
    )
    Is
    Type Xdmlrectype is Record (Col1 Varchar2 (66));
    Type Xdmltype is Table of Xdmlrectype;
    RTN Xdmltype;
    Begin
    Internal_Id Select Bulk collect into Rtn of Zc_State;
    Open mu_cur to select table col1 (rtn);
    end;
    /
    ---
    11/42 PLS-00642: types of local collections not allowed in SQL queries
    11/36 PL/SQL: ORA-22905: cannot access the rows of a table not nested element
    11/19 PL/SQL: statement ignored
    Display errors;

    Not something I would personally like to implement.

    But for educational purposes only of course...

    create table this_will_be_gross
    (
       column1 number,
       column2 varchar2(30)
    
    );
    
    insert into this_will_be_gross values (1, 'begin the ugliness');
    insert into this_will_be_gross values (2, 'end the ugliness');
    
    variable x refcursor;
    
    ME_XE?
    declare
       Rtn sys.ODCIVARCHAR2LIST;
    BEGIN
       SELECT
          column1 || '-' || column2 Bulk Collect
       INTO
          Rtn
       FROM
          this_will_be_gross;
    
       OPEN :x FOR
       SELECT
          regexp_substr (column_value, '[^-]+', 1, 1) as column1,
          regexp_substr (column_value, '[^-]+', 1, 2) as column2
       FROM TABLE(CAST(rtn AS sys.ODCIVARCHAR2LIST));
    end;
     17  /
    
    PL/SQL procedure successfully completed.
    
    Elapsed: 00:00:00.09
    ME_XE?
    ME_XE?print :x
    
    COLUMN1                        COLUMN2
    ------------------------------ ------------------------------
    1                              begin the ugliness
    2                              end the ugliness
    
    2 rows selected.
    
    Elapsed: 00:00:00.11
    

    In the above example I have "know" that a hyphen was a safe character to use to break my data items (as could not find anywhere in the data itself).

    I strongly encourage you don't not to implement something like this. I know it's tempting when you work in harsh environments where it may take a serious battle to get structures such as temporary tables or the SQL Types created, but it is really the right way to do it.

  • order by clause does not work in plsql cursor

    I have a sql that works well in sqlplus, but when I add it to a cursor in plsql, it doesn't. Also, I discovered that it works very well in plsql if I remove the order by clause.

    We cannot use "order by" clause in plsql?

    I have to explicitly use the name of the column to select the cause for which I ' order by '?

    Here is the work and not work code:

    -Works fine in sqlplus
    Select * from mgmt$ compliance_standard_rule where ((rule_iname comme '_SecRepRul %') OU))
    (substr(rule_iname,9) in ('AUDIT_SYS_OPS'))) and target_type = "oracle_database" order of rule_iname

    -Works fine in plsql
    CURSOR c_rule_guids_database () IS
    Select * from mgmt$ compliance_standard_rule where ((rule_iname comme '_SecRepRul %') OU))
    (substr(rule_iname,9) in ('AUDIT_SYS_OPS'))) and target_type = "oracle_database."
    );

    -Does not work in plsql: PL/SQL: ORA-00907: lack the right parenthesis
    CURSOR c_rule_guids_database () IS
    Select * from mgmt$ compliance_standard_rule where ((rule_iname comme '_SecRepRul %') OU))
    (substr(rule_iname,9) in ('AUDIT_SYS_OPS'))) and target_type = "oracle_database" order of rule_iname
    );

    Thanks for the help.

    Remove the parentheses around your return cursor:

    SQL> declare
      2      CURSOR c_rule_guids_database IS
      3      (select *
      4       from   compliance_standard_rule
      5       where ((rule_iname like '%_SecRepRul')
      6               OR
      7              (substr(rule_iname,9) in ('AUDIT_SYS_OPS'))
      8             )
      9       and   target_type = 'oracle_database'
     10       order by rule_iname
     11      );
     12  begin
     13     null;
     14  end;
     15  /
         order by rule_iname
         *
    ERROR at line 10:
    ORA-06550: line 10, column 6:
    PL/SQL: ORA-00907: missing right parenthesis
    ORA-06550: line 3, column 5:
    PL/SQL: SQL Statement ignored
    
    SQL> declare
      2      CURSOR c_rule_guids_database IS
      3       select *
      4       from   compliance_standard_rule
      5       where ((rule_iname like '%_SecRepRul')
      6               OR
      7              (substr(rule_iname,9) in ('AUDIT_SYS_OPS'))
      8             )
      9       and   target_type = 'oracle_database'
     10       order by rule_iname
     11       ;
     12  begin
     13     null;
     14  end;
     15  /
    
    PL/SQL procedure successfully completed.
    
  • Table or record

    Hello

    When I started coding in PL/SQL our DBA/architect said it is better to create a record of paintings rather than an array of records. Is this always true?


    Database version: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi

    This statement would be true if you plan to use the FORALL statement with your collection. In versions 9i and 10g, there is a restriction that prevents you from listing of the individual attributes of the records with FORALL. (table of records). (PLS-00436: limitation of the implementation: cannot reference the fields in the table to LINK BULK records)

    This restriction has been removed in Oracle 11 g.

  • Horizontal table of records

    Is it possible for a table view records horizontally rather than vertically:

    That is to say. This way:

    01 A 02 A B 03 B B

    Instead of this way:
    01 A AND B
    02 A AND B
    03 A AND B

    Published by: bobmagan on November 12, 2009 05:42

    Hello

    Try to use for-each@inlines.

    Thank you.

  • How to create a table variable

    Hi people,

    I develop a fly activity, for each branch created, I need to pass different values (that I get from DB).

    For this, my plan would be,
    -create a load of variables, array of all the values in the table (from DB)
    -pass the array to each branch in fly activity based on the index

    As I am newbie to BPEL, I don't know how to create a table variable.

    You people could guide me please.


    Concerning
    VIKI

    To add to the response of Anne:

    use XPATH to get your value

    entry/string_array / [1]
    / string_array/input [$counter]

  • PLSQL - complete the table of records using the constructor

    Hello

    Stripped of example of what I'm doing. I know I've done this before, but my SVN is arrested for maint atm. Don't know why I get this error:

    Thank you.
    DECLARE
        
        TYPE t_Record IS RECORD
        (
            Table_Name  VARCHAR2(30),
            Num_Rows    NUMBER
        );
        TYPE t_RecordList IS TABLE OF t_Record;
        
        v_Record        t_Record;
        v_Tables        t_RecordList    := t_RecordList();
        v_Schema        VARCHAR2(50)   := 'SYS';
        
    BEGIN
    
        FOR i IN (SELECT * FROM all_tables WHERE owner = v_Schema)
        LOOP
        
            v_Tables.EXTEND;
            v_Tables(v_Tables.LAST) := t_Record(i.Table_Name, i.Num_Rows); -- Line 19
        
        END LOOP;
    
    END;
    
    ORA-06550: line 19, column 36:
    PLS-00222: no function with name 'T_RECORD' exists in this scope

    Documents is not the builders functions, something like this might work (unless you want to use objects instead):

    v_Tables(v_Tables.LAST).Table_Name := i.Table_Name;
    v_Tables(v_Tables.LAST).Num_Rows :=  i.Num_Rows;
    
  • Doubt of external Table

    Hi Master,

    Using Sql * Loader I can load the dat/csv/txt data to oracle tables. I can use it when clause contained in the data file and load control in different tables.

    e.g. when deptno = 20 then table 1. Where deptno = 10 then table2 etc...

    But using the external table... How can I load data in different tables as an example above? I googled. but do not get appropriate information. Please advise... !!

    Concerning

    AR

    Bad code. You use positional WHEN when you define variable length fields. As a result, your code will load Department 201, 2090,...:

    SQL > create table T_DEPTNO_20)

    NUMBER 2 DEPTNO,

    3 DNAME VARCHAR2 (14).

    LOC 4 VARCHAR2 (13)

    5)

    6 EXTERNAL ORGANIZATION

    () 7

    ORACLE_LOADER TYPE 8

    9 DEFAULT TEMP DIRECTORY

    10 ACCESS SETTINGS

    (11)

    12 RECORDS DELIMITED BY NEWLINE

    13 CHARGE WHEN (1:2) = "20"

    14 LOGFILE 'MyFile.log.

    15 BADFILE "MyFile.bad."

    16 NODISCARDFILE

    17 FIELDS TERMINATED BY ', '.

    18 EVENTUALLY FRAMED BY "" "

    RTRIM 19

    20 MISSING FIELD VALUES ARE NULL

    (21)

    22 DEPTNO,

    23 DNAME,

    LOC 24

    25)

    26)

    27 RENTAL ("MyFile.csv")

    28)

    RELEASE 29 UNLIMITED LIMIT

    30.

    Table created.

    SQL > select * from T_DEPTNO_20

    2.

    DEPTNO DNAME LOC

    ---------- -------------- -------------

    SEARCH 20 DALLAS

    201 DO NOT LOAD ARMPIT

    SQL > drop table T_DEPTNO_20

    2.

    Deleted table.

    SQL > create table T_DEPTNO_20)

    NUMBER 2 DEPTNO,

    3 DNAME VARCHAR2 (14).

    LOC 4 VARCHAR2 (13)

    5)

    6 EXTERNAL ORGANIZATION

    () 7

    ORACLE_LOADER TYPE 8

    9 DEFAULT TEMP DIRECTORY

    10 ACCESS SETTINGS

    (11)

    12 RECORDS DELIMITED BY NEWLINE

    13 CHARGER WHEN deptno = '20'

    14 LOGFILE 'MyFile.log.

    15 BADFILE "MyFile.bad."

    16 NODISCARDFILE

    17 FIELDS TERMINATED BY ', '.

    18 EVENTUALLY FRAMED BY "" "

    RTRIM 19

    20 MISSING FIELD VALUES ARE NULL

    (21)

    22 DEPTNO,

    23 DNAME,

    LOC 24

    25)

    26)

    27 RENTAL ("MyFile.csv")

    28)

    RELEASE 29 UNLIMITED LIMIT

    30.

    Table created.

    SQL > select * from T_DEPTNO_20

    2.

    DEPTNO DNAME LOC

    ---------- -------------- -------------

    SEARCH 20 DALLAS

    SQL >

    SY.

  • Apex 4.2 newbie: dynamic action, PLSQL expression &amp; bind variable

    Hello

    I'm in the Action page dynamic editing > settings-> Expression PLSQL.

    A test, I want to do a textfield equal to the value of another field. All of the remaining work, I need to do on my form is based on this capability, for example, if I can filter the content of my shuttle with a textfield. But for now, nice and simple: a textfield equal to another.

    The problem is that my link variable appears to return a null value when it's non-zero.

    Thus, for example, field entering the PLSQL Expression NVL(:P1_PAGE_ITEM_TEXT,'No') returns always 'no' to a textfield in the page. However, P1_PAGE_ITEM_TEXT is not null - I put a refresh on shot down and I am happily adding text... but the textfield shows simply "no".

    Googling, I see other people had similar problems a few years back and resorted to JS instead of PLSQL. But I think it's more likely that I'm doing it wrong that it's a bug! (Dynamic - Action Alert view the value in the field

    I would be grateful if someone could confirm that it is possible to do what I want to do - and how!

    Thank you
    Emma

    Published by: 995005 on March 21, 2013 05:46

    Published by: 995005 on March 21, 2013 05:47

    Construction IN is always a nasty...
    because you get: where id in "a, b, c" (where a, b, c is the value of P1_PAGEITEM)
    and you should get: where id in ('a', 'b', 'c')
    There is no easy solution for this. If you must certainly construction IN you "convert" the value of P1_PAGEITEM to a table (with a function in pipeline and apex_util.string_to_table). Just Google for a solution.

    Try to make it work with a single value first (before that you increase the complexity)

    And the definition of LOV should be: SELECT description, Àtable FROM returnvalue to display the description.

  • Run DA plsql code table updated using the click of checkbox

    Hello
    I have a box with action Dynamics plsql code to update a table when event = click/change, but only when the box is turned "on" everything seems to be ok, but the code plsql for updating the table does not work because the record in the table is not updated. Any help on this pls?

    Tell us is there a LOV for item checkbox?

    Try sth like this:

    Lets assume the id box is P1_CHECK.
    Interior check point to put the list of values like this:

    
            STATIC:CheckMe;1
    
        
    

    Then, when you create a dynamic action, put smth like this:

        Event: Clicked
        Selection Type: Item
        Item: P1_CHECK
        Condition: equal to
        Value: 1
        
    

    or

        Event: Clicked
        Selection Type: Item
        Item: P1_CHECK
        Condition: JavaScript expression
        Value: $x('P1_CHECK_0').checked
        
    

    Hope this helps you, Mimi

    Published by: Mimi on October 28, 2012 21:06

    Published by: Mimi on October 28, 2012 21:09

  • Need help for plsql cursor

    Hi all

    I need to insert values into a table A, of similar structure to the other table b. (the two havin same number of columns with same type).

    IM using a cursor to retrieve the values in table B and im loop fetch the values of the cursor on the temporary variable of the same type as the table B and im trying to insert values into a table using the following statement

    insert into table values (variable temperature) A;

    When I tried to perform the procedure is to show an error "not enough of values".
    I is not clear if we use the Insert as above or there at - it another way to achieve the same.


    Help, please.

    Kind regards
    Mohan

    Hello

    SQL> desc students
     Name                                      Null?    Type
     ----------------------------------------- -------- --------------
     ID                                                 NUMBER(4)
     FIRSTNAME                                          VARCHAR2(10)
     LASTNAME                                           VARCHAR2(30)
     ADDRESS                                            VARCHAR2(30)
     BITHDAY                                            DATE
     GROUPID                                            NUMBER(4)
    
    SQL> select * from students;
    
            ID FIRSTNAME  LASTNAME
    ---------- ---------- ------------------------------
    ADDRESS                        BITHDAY      GROUPID
    ------------------------------ --------- ----------
          1000 vitaly     men
    beer sheva                     20-MAR-87       1000
    
    SQL> create table stud as select * from students where 1=2;
    
    Table created.
    
    SQL> declare
      2  cursor c is select * from students;
      3  Begin
      4  for r in c loop
      5  insert into stud (ID,FIRSTNAME,LASTNAME,ADDRESS,BITHDAY,GROUPID) values (r);
      6  end loop;
      7  End;
      8
      9
     10          /
    insert into stud (ID,FIRSTNAME,LASTNAME,ADDRESS,BITHDAY,GROUPID) values (r);
                                                                     *
    ERROR at line 5:
    ORA-06550: line 5, column 66:
    PL/SQL: ORA-00947: not enough values
    ORA-06550: line 5, column 1:
    PL/SQL: SQL Statement ignored
    
    SQL> 
    
    SQL> declare
      2  cursor c is select * from students;
      3  Begin
      4  for r in c loop
      5  insert into stud (ID,FIRSTNAME,LASTNAME,ADDRESS,BITHDAY,GROUPID) values (r.ID,r.FIRSTNAME,r.LAS
    TNAME,r.ADDRESS,r.BITHDAY,r.GROUPID);
      6  end loop;
      7  End;
      8         /
    
    PL/SQL procedure successfully completed.
    
    SQL> select * from stud;
    
            ID FIRSTNAME  LASTNAME
    ---------- ---------- ------------------------------
    ADDRESS                        BITHDAY      GROUPID
    ------------------------------ --------- ----------
          1000 vitaly     men
    beer sheva                     20-MAR-87       1000
    

    Twinkle

  • Where is the setting for the WCC tables of records?

    More precisely what scheme they reside in? I can see a schema called DEV_URMSERVER but the tables are almost all empty and I have certainly some documents and records. Maybe I have a problem NLSLANG

    DEV_OCS looks promising

  • selection of the missing records between 2 duplicity without worrying about tables of records

    Hi all

    I have received_bills and send_bills of 2 tables.

    The SEND_BILLS table is the source table displaying all records in it.

    I need to compare two tables together and insert all the missing elements in received_items including duplicate records.

    There may be duplicate in 2 tables records.

    I wrote a query, but it does not select the duplicate records if it's all the 2 tables. When the same duplicate records are send_bills and received_bill without worrying because send_bills has 4 of them and received_bill 2, it does not select the other 2 duplicate records. And it's just what I need.

    the query is

    SELECT SEND. POINT OF REFERENCE,

    Send. PAYMENT,

    Send. CODE

    OF SEND_BILLS SEND

    WHERE THERE IS NOT (SELECT REC. DATUM, PAYMENT, REC. REC. CODE

    OF RECEIVED_BILLS REC

    WHERE REC. REFERENCE = SEND. SCRATCH CARDS

    AND REC. PAYMENT = SEND. PAYMENT

    AND REC. CODE = SEND. CODE)

    send_bills records

    OCTOBER 10, 1519A1
    OCTOBER 10, 1519A1
    OCTOBER 10, 1519A1
    OCTOBER 10, 1529A3
    OCTOBER 10, 1547A4
    9 OCTOBER 1519A8
    OCTOBER 10, 1520A1
    OCTOBER 10, 1519A1
    OCTOBER 10, 1525A5
    OCTOBER 10, 1525A5

    received_bills records

    OCTOBER 10, 1519A1
    OCTOBER 10, 1529A3
    OCTOBER 10, 1547A4
    OCTOBER 10, 1519A1

    the result of the query is:

    OCTOBER 10, 1525A5
    OCTOBER 10, 1525A5
    OCTOBER 10, 1520A1
    9 OCTOBER 1519A8

    So he selects all the records

    the result should be

    OCTOBER 10, 1525A5
    OCTOBER 10, 1525A5
    OCTOBER 10, 1520A1
    9 OCTOBER 1519A8
    OCTOBER 10, 1519A1
    OCTOBER 10, 1519A1

    --------------------------------------------------------

    -The DOF for Table SEND_BILLS

    --------------------------------------------------------

    CREATE TABLE SEND_BILLS

    (DATE OF "DATUM",

    NUMBER OF "PAYMENT."

    'CODE' VARCHAR2 (5 BYTE)

    )  ;

    --------------------------------------------------------

    -The DOF for Table RECEIVED_BILLS

    --------------------------------------------------------

    CREATE TABLE 'RECEIVED_BILLS '.

    (DATE OF "DATUM",

    NUMBER OF "PAYMENT."

    'CODE' VARCHAR2 (5 BYTE)

    )  ;

    -Insert the script for send_bills

    Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1');

    Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1');

    Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1');

    Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 29, 'A3');

    Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 47, 'A4');

    Insert into SEND_BILLS (DATUM, CODE) values (to_date('09-OCT-15','DD-MON-RR'), 19, 'A8');

    Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 20, 'A1');

    Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1');

    Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 25, 'A5')

    Insert into SEND_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 25, 'A5')

    -Insert invoices received from script

    Insert into RECEIVED_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1');

    Insert into RECEIVED_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 29, 'A3');

    Insert into RECEIVED_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 47, 'A4');

    Insert into RECEIVED_BILLS (DATUM, CODE) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1');

    Can someone please help me with the query so that I can also select all the missing records, including duplicates.

    Thanks in advance.

    Best regards

    Caroline

    If you should by all means use loop and then (send_bills and received_bills contain the same data as your original post):

    Select the reference, payment, code

    of (with

    Duplicator (Datum, Payment, code, CNT) as

    (select the reference, code, payment, cnt - 1).

    from (select datum, payment, code, count (one) - cnt count (two)

    (select date, payment, code, 1 one, to_number (null) two)

    of send_bills

    Union of all the

    Select datum, payment, code, to_number (null), 2 two

    of received_bills

    )

    Reference group, code

    having count (one)! = count (two)

    )

    Union of all the

    Select the reference code, payment, cnt - 1

    The duplicator

    where cnt > 0

    )

    Select the reference, payment, code

    The duplicator

    )

    DATUM PAYMENT CODE
    10/09/2015 19 A8
    10/10/2015 19 A1
    10/10/2015 25 A5
    10/10/2015 20 A1
    10/10/2015 19 A1
    10/10/2015 25 A5

    Concerning

    Etbin

Maybe you are looking for

  • number of channels evil

    I have a fieldpoint configuration to query all channels on a DO401. This is how I can get feedback on the status of all channels. However, when I read the output, he returned 32 instead of 16 values. This could be the cause? I have a workaround to ma

  • HP deskjet 5650 color with the IMac use

    Hope you can help - tried to install the new driver to activate my printer to print in color when it is connected to the new Imac.  Operating system is OS X Maverick and is not in the drop-down options on the HP website.  My printer is really too old

  • HP g60-630us: power button to computer hp laptop

    The power button is released, and when I put it on it turns on at first. even if it was not attached then nothing. I need more of a replacement button?

  • BlackBerry Smartphones BLUETOOTH CONNECTIONS

    Is it possible to "automatically" receive incoming calls either completely hands-free, when a Bluetooth headset is connected.  It seems at the time where I have to press the button "" on the earpiece to receive.  I have a Jabra.

  • App Podcast of blackBerry for Curve Smartphones

    I got my curve for a month now and still does not know how to access the podcasts! Found this link to download the podcast app: http://ca.blackberry.com/apps/blackberry-apps/podcast.html#tab-1 The page lists the system requirements (I have them all):