Move rejected records to a table during a data load
Hi all
When I run my interfaces sometimes I get errors caused by "invalid records. I mean, some contents of field is not valid.
Then I would move these invalid to another table records, while the data loading lights in order not to interrupt the loading of data.
How can I do? There are examples that I could follow?
Thanks in advance
concerning
Hi Alvaro,
Here you can find different ways to achieve this goal and choose according to your requirement:
https://community.Oracle.com/thread/3764279?SR=Inbox
Tags: Business Intelligence
Similar Questions
-
SQL * Loader - rejected records - error on table ORA-01722: invalid number
Get the following errors:
Please tell me where I'm wrong?
The log file and extracts the data file with the control file is attached.
Also guide me please how I can download 4900 files at once?
-------------------------------------
SQL * Loader: release 11.1.0.7.0 - Production on Fri 14 Oct 03:06:06 2011
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Control file: sample.ctl
Data file: Cities.csv
Bad leadership: Cities.bad
Discard File: none is specified
(Allow all releases)
Number of loading: ALL
Number of jump: 0
Authorized errors: 50
Link table: 64 lines, maximum of 256000 bytes
Continuation of the debate: none is specified
Path used: classics
Table CITY, loaded from every logical record.
Insert the option in effect for this table: INSERT
Column Position Len term Encl. Datatype name
------------------------------ ---------- ----- ---- ---- ---------------------
FIRST ID *, CHARACTER
35. ACCORDING TO NAME, ' CHARACTER
COUNTRYCODE 3, ' CHARACTER
THE NEXT POPULATION * CHARACTER WHT
Sheet 1: Rejected - error on the table CITY, POPULATION column.
ORA-01722: invalid number
Sheet 2: Rejected - error on the table CITY, POPULATION column.
ORA-01722: invalid number
Sheet 3: Rejected - error on the table CITY, POPULATION column.
ORA-01722: invalid number
Folder 4: Rejected - error on the table CITY, POPULATION column.
ORA-01722: invalid number
Sheet 5: Rejected - error on the table CITY, POPULATION column.
ORA-01722: invalid number
Sheet 6: Rejected - error on the table CITY, POPULATION column.
ORA-01722: invalid number
Sheet 7: Rejected - error on the table CITY, POPULATION column.
ORA-01722: invalid number
Sheet 8: Rejected - error on the table CITY, POPULATION column.
ORA-01722: invalid number
File 9: Rejected - error on the table CITY, POPULATION column.
ORA-01722: invalid number
Case 10: Rejected - error on the table CITY, POPULATION column.
ORA-01722: invalid number
Factsheet 11: Rejected - error on the table CITY, POPULATION column.
ORA-01722: invalid number
Sheet 12: Rejected - error on the table CITY, POPULATION column.
ORA-01722: invalid number
File 13: Rejected - error on the table CITY, POPULATION column.
ORA-01722: invalid number
Fact sheet 14: Rejected - error on the table CITY, POPULATION column.
ORA-01722: invalid number
Fact sheet 15: Rejected - error on the table CITY, POPULATION column.
ORA-01722: invalid number
Sheet 16: Rejected - error on the table CITY, POPULATION column.
ORA-01722: invalid number
File 17: Rejected - error on the table CITY, POPULATION column.
ORA-01722: invalid number
Sheet 18: Rejected - error on the table CITY, POPULATION column.
ORA-01722: invalid number
File 19: Rejected - error on the table CITY, POPULATION column.
ORA-01722: invalid number
Sheet 20: Rejected - error on the table CITY, POPULATION column.
ORA-01722: invalid number
Sheet 21: Rejected - error on the table CITY, POPULATION column.
ORA-01722: invalid number
Account 22: rejected - error on the table CITY, POPULATION column.
ORA-01722: invalid number
Sheet 23: Rejected - error on the table CITY, POPULATION column.
ORA-01722: invalid number
Record number of 24: rejected - error on the table CITY, POPULATION column.
ORA-01722: invalid number
Sheet 25: Rejected - error on the table CITY, POPULATION column.
ORA-01722: invalid number
Fact sheet 26: Rejected - error on the table CITY, POPULATION column.
ORA-01722: invalid number
Fact sheet 27: Rejected - error on the table CITY, POPULATION column.
ORA-01722: invalid number
Record 28: Rejected - error on the table CITY, POPULATION column.
ORA-01722: invalid number
Record 29: rejected - error on the table CITY, POPULATION column.
ORA-01722: invalid number
Record 30: Rejected - error on the table CITY, POPULATION column.
ORA-01722: invalid number
Record of 31: rejected - error on the table CITY, POPULATION column.
ORA-01722: invalid number
• Statement 32: Rejected - error on the table CITY, POPULATION column.
ORA-01722: invalid number
Record 33: Rejected - error on the table CITY, POPULATION column.
ORA-01722: invalid number
Page 34: Rejected - error on the table CITY, POPULATION column.
ORA-01722: invalid number
Record 35: Rejected - error on the table CITY, POPULATION column.
ORA-01722: invalid number
Record 36: Rejected - error on the table CITY, POPULATION column.
ORA-01722: invalid number
Record 37: Rejected - error on the table CITY, POPULATION column.
ORA-01722: invalid number
Record 38: Rejected - error on the table CITY, POPULATION column.
ORA-01722: invalid number
Sheet 39: Rejected - error on the table CITY, POPULATION column.
ORA-01722: invalid number
Record 40: Rejected - error on the table CITY, POPULATION column.
ORA-01722: invalid number
Sheet 41: Rejected - error on the table CITY, POPULATION column.
ORA-01722: invalid number
Page 42: Rejected - error on the table CITY, POPULATION column.
ORA-01722: invalid number
Record 43: Rejected - error on the table CITY, POPULATION column.
ORA-01722: invalid number
Sheet 44: Rejected - error on the table CITY, POPULATION column.
ORA-01722: invalid number
Record 45: Rejected - error on the table CITY, POPULATION column.
ORA-01722: invalid number
• Statement 46: Rejected - error on the table CITY, POPULATION column.
ORA-01722: invalid number
Record 47: Rejected - error on the table CITY, POPULATION column.
ORA-01722: invalid number
Record 48: Rejected - error on the table CITY, POPULATION column.
ORA-01722: invalid number
Record 49: Rejected - error on the table CITY, POPULATION column.
ORA-01722: invalid number
Page 50: Rejected - error on the table CITY, POPULATION column.
ORA-01722: invalid number
Record 51: Rejected - error on the table CITY, POPULATION column.
ORA-01722: invalid number
NUMBER of MAXIMUM ERRORS EXCEEDED - above the statistics reflect partial performance.
CITY table:
0 rows successfully loaded.
51 lines not filled due to data errors.
0 rows not loading because all WHEN clauses were failed.
0 rows not populated because all fields are null.
The space allocated to bind table: 35840 bytes (64 lines)
Bytes of read buffer: 1048576
Total logical records ignored: 0
Total logical records read: 64
Total rejected logical records: 51
Total logical records ignored: 0
Run started on Fri 14 Oct 03:06:06 2011
Run finished Fri Oct 14 03:06:12 2011
Time was: 00:00:06.18
Time processor was: 00:00:00.03
----------------------------------------------------------------------
my control file (sample.ctl):
Load data infile 'Cities.csv '.
in the town of table
fields completed by «,»
(external id integer,
char (35) name box by ' ', '
CountryCode tank (3) box by ' ', '
external population integer terminated by '\n '.
)
my data (Cities.csv) file (it contains 4900 documents, but I show here just 4 records for ease)
3830, "Virginia Beach", "USA", 425257
3831, 'Atlanta', 'USA', 416474
3832, "Sacramento", "USA", 407018
3833, 'Oakland', 'USA', 399484
Thanks in advance!Watch when I have a little change your database as follows
1,'Kabul','AFG',1780000 2,'Qandahar','AFG','237500' 3,'Herat','AFG','186800'
I got the same error (last 2 rows rejected for the same number invalid error)
mhouri > select * from cities; ID NAME COU POPULATION ---------- ----------------------------------- --- ---------- 1 Kabul AFG 1780000 SQL*Loader: Release 10.2.0.3.0 - Production on Fri Oct 14 10:38:06 2011 Copyright (c) 1982, 2005, Oracle. All rights reserved. Control File: cities.ctl Data File: cities.dat Bad File: cities.bad Discard File: none specified (Allow all discards) Number to load: ALL Number to skip: 0 Errors allowed: 50 Bind array: 64 rows, maximum of 256000 bytes Continuation: none specified Path used: Conventional Table CITIES, loaded from every logical record. Insert option in effect for this table: INSERT Column Name Position Len Term Encl Datatype ------------------------------ ---------- ----- ---- ---- --------------------- ID FIRST * , CHARACTER NAME NEXT 35 , ' CHARACTER COUNTRYCODE NEXT 3 , ' CHARACTER POPULATION NEXT * WHT CHARACTER Record 4: Rejected - Error on table CITIES, column ID. Column not found before end of logical record (use TRAILING NULLCOLS) Record 2: Rejected - Error on table CITIES, column POPULATION. ORA-01722: invalid number Record 3: Rejected - Error on table CITIES, column POPULATION. ORA-01722: invalid number Table CITIES: 1 Row successfully loaded. 3 Rows not loaded due to data errors. 0 Rows not loaded because all WHEN clauses were failed. 0 Rows not loaded because all fields were null. Space allocated for bind array: 35840 bytes(64 rows) Read buffer bytes: 1048576 Total logical records skipped: 0 Total logical records read: 4 Total logical records rejected: 3 Total logical records discarded: 0 Run began on Fri Oct 14 10:38:06 2011 Run ended on Fri Oct 14 10:38:06 2011 Elapsed time was: 00:00:00.23 CPU time was: 00:00:00.09
Value of the population within the data file must be a number
Best regards
Mohamed Houri
-
How to select a record in one table to manipulate data in a database?
Hello community,
Using 32-bit Labview 2015.
I created a user interface that runs a query and retrieves my table from a sql database.
I want to be able to manage only one record at a time by selecting the record in my table and then manipulate the data according to the needs.
Whenever the user runs a query, I want as the first record in the table to be selected / highlighted.
I want an indicator that is currently active.
Then a click of a button, to be able to scroll the actively selected record.
Once I have the selected record, I want a way to write a query to edit or delete the record.
Is attached a photo of my query to select all of my table and connect data in my table (results).
Attached a photo of my painting showing the timeline of my sql database.
What is the best way to go on a record selection in a table and the modification of data with a query?
Any help would be greatly appreciated.
Thank you
I guess that's not a table, but multi-column listbox.
Right click, select--> highlight whole line selection Mode
The value of the multicolumn listbox is the row index - you can write a local variable to highlight the line, the event structure to handle the user clicking on, etc.
If you enable the property editable ListBox cells, you can allow users to edit the items of the listbox.
If you want to get the data in row, you hint REF table and work with the array of strings in row - convert it to cluster, etc..
I don't know, what type of data, it is, how you structure the database looks like, I don't even know if you use the wrapper to work with the database, I can't write queries for you.
Something like Update Tablica Set Serial = '5' where ID = '22';
-
Updated tables during the weekly load?
All,
We are running Oracle 10 g. We try to identify the tables that updated operating expenses of our weekly or monthly. I did Internet searches including this forum, but have not yet found anything useful. I tried the trigger option; It works, but increases significantly at run time. For example, a stored procedure that would run between 1-2 minutes to load approximately 6 500 lines, it took 12 minutes to complete. For the moment, our weekly workload runs in about 7 hours. I predict adding triggers for selected tables drastically increases at run time. I also check the most recent row id won't help with updates and deletions. In addition, the following code works fine when running in Oracle 10 g personal edition, but when running in the development environment, it fails.
ORA-08181: the specified number is not a number of regime change in forceselect scn_to_timestamp(ora_rowscn) from EMPLOYEE;
ORA-06512: at "SYS." SCN_TO_TIMESTAMP', line 1
Are there other options other than what I've listed above in order to detect when a table is updated of our weekly load process?
Thanks in advance,
SeyedAll chastise you for instrumentation does not is correct, but the other option you have "explored" failed because you do not quite understand it.
Ora_rowscn, is a pseudo column that returns either the RCS of the last change to the block or rank, depending on how the table has been set. The SCN_TO-TIMESTAMP function throws this SNA at a table to perform the conversion. No each NPC is here, I think that the rule is the last fortnight of SNA are there, obviously depends on many variables.
Your selection did this look upward to the entire table. The "early" lines probably have not been affected over the years, SNA of these blocks have long aged out of the system table. In addition, you don't have the RCS for EACH line, just the last of them has changed.
Here's how you can use it.
build a table with three columns (table_name, pre_load_SCN, Post_load_SCN)... before run you out of the lot, which fills with the MAX (Ora_rowscn) of each table. Execute the batch, update of this table with the MAX (Ora_rowscn) still once and for all the tables, a table that does not at least had a line changed since the date of your first analysis.
Problem: Could be any process, not just the batch. So if you know, NOTHING else is running... you might be sure that you have captured the list of modified tables.
-
exp/imp only a few records in the table
Hello
Exp/imp few records in my table during the activity level exp/imp table is possible?
If so, what setting should I be using
For example,.
I have 10000 records in my narration of the table "TEST_TB".
I have the dump full exp for the table.
But I want to just imp only 50000 records from the same table in another schema.
How would it be possible?
Please suggest me on this
Kind regards
FaizHello
It seems not possible to limit the number of rows that is imported, but it is possible to limit the number of rows exported with the query parameter, found examples
http://www.orafaq.com/wiki/Import_Export_FAQ
http://docs.Oracle.com/CD/B28359_01/server.111/b28319/exp_imp.htm#autoId52HtH
Johan -
Apex data load configuration missing table when importing to the new workspace
Hi everyone knows this show before and have a work around.
I export / import my request for a different workspace, and everything works fine except for 1 loading tables data.
In my application, I use tables of data loading, and it seems that the latter do not properly Setup for the table object to load data. This causes my application to fail when the user tries to download a text file.
Does anyone have a work around next to recreate the table of data load object?
Breadcrumb: Components shared-> load data tables-> add modify data load table
The app before exporting displays Workspace: OOS
Single column 1 - CURRENCY_ID (number)
Single column 2 - month (Date)
When I import the app in the new workspace (OOS_UAT) data type is absent.
Single column 1 - CURRENCY_ID
Single column 2 - MONTH
When I import the same workspace app: OOS I do not know this problem
Version of the apex: Application Express 4.1.1.00.23Hi all
If you run 4.1.1 it was a bug 13780604 (DATA DOWNLOAD WIZARD FAILED if EXPORTS of OTHER workspace) and have been fixed. You can download the fix for 13780604 (support.us.oracle.com) and the associated 4.1.1
Kind regards
Patrick -
How to move from records in a procedure with Table Type as a parameter block
Hello
How can I move all records in a block of PL/SQL procedure with argument of Type Table or Refcursor.
I created a procedure in the backend with a parameter of Type table. Of the form, I want to call this procedure with the argument that ALL of the records in BULK.
Y at - it a simple method for it.
Thanks in advance
RizlyRizly,
I recently put in place a level of forms audit process that uses this method very - package of database, which takes an array of Records as a parameter. Forms 10 G supports this nicely. We have sought to implement this through a set of database triggers (update, insert, delete) but due to our requirements, it was not the best place to do so that we have implemented this in forms.Brief history on my form. The main block was based on a table, and the block has been marked NOT can, Insert and Delete. If the user wants to insert, update, or delete a record they clicked on Insert, Update, or Delete button that opens a popup form where they seized a reason Code and a Description of the transaction and then clicked a button Save.
Here's what I did.
Database side *.
1 package database with a Record of PL/SQL and PL/SQL records in the Table variable declared in the Package specification.
2. create INSERT_?, warning? and DELETE_? package procedures to manage integration, updates and deletions.
Secondary forms *.
1 create a table (control) Non-Base with all fields block
2. create a button that performs a loop on the block and all values assigns to the variable of records in the Table (ToR) forms (typed off the DB package)
3. pass the ToR to the appropriate database package procedure.Here is an example of the code I wrote:
Database side *.
Package specifications * (Note: replacewith your database schema name) also note, I use PL/SQL Developer with the PLDoc plug-in so I documentation tags in my code. CREATE OR REPLACE PACKAGE
.Transaction_Log_pkg IS -- Package Global Variables -- ------------------------ TYPE rec_T_Log IS RECORD ( table_name .transaction_log.table_name%TYPE ,trans_type .transaction_log.trans_type%TYPE ,trans_key .transaction_log.trans_key%TYPE ,action .transaction_log.action%TYPE ,column_name .transaction_log.column_name%TYPE ,old_value .transaction_log.old_value%TYPE ,new_value .transaction_log.new_value%TYPE ,trans_date .transaction_log.trans_date%TYPE ,user_id .transaction_log.user_id%TYPE ,reason_code .transaction_log.reason_code%TYPE ,comments .transaction_log.comments%TYPE ); TYPE tbl_T_Log IS TABLE OF rec_T_Log INDEX BY BINARY_INTEGER; -- Insert_Record -------------------------------------------------------------------------------- /** Procedure adds "INSERT" audting records in to the CIR.TRANSACTION_LOG table %param p_t_log TABLE_OF_RECORDS %desc You can pass a single record or a group of records. Allows you to package up all of the values inserted in a table and send them to the Insert_Record procedure as a group rather than as individual transactions. -- ---------------------------------------------------------------------------------------------- */ PROCEDURE Insert_Record (p_t_log tbl_T_Log ); -- Update_Record -------------------------------------------------------------------------------- /** Procedure adds a "UPDATE" record(s) in the CIR.TRANSACTION_LOG table %param p_t_log TABLE_OF_RECORDS %desc You can pass a single record or a group of records if more than one value in a row is updated. -- ---------------------------------------------------------------------------------------------- */ PROCEDURE Update_Record (p_t_log tbl_T_Log ); -- Delete_Record -------------------------------------------------------------------------------- /** Procedure adds "DELETE" records in to the CIR.TRANSACTION_LOG table %param p_t_log TABLE_OF_RECORDS %desc You can pass a single record or a group of records. Allows you to package up all of the values inserted in a table and send them to the Delete_Record procedure as a group rather than as individual transactions. -- ---------------------------------------------------------------------------------------------- */ PROCEDURE Delete_Record (p_t_log tbl_T_Log ); END Transaction_Log_pkg; Package body *.
-- Beginning of Package Body ------------------------------------------------------------------------- -- --------------------------------------------------------------------------------------------------- CREATE OR REPLACE PACKAGE BODY
.Transaction_Log_pkg AS -- Package EXCEPTIONS -- ------------------ null_table EXCEPTION; null_table_name EXCEPTION; null_trans_type EXCEPTION; null_trans_key EXCEPTION; null_action EXCEPTION; null_column_name EXCEPTION; null_value EXCEPTION; null_user_Id EXCEPTION; null_reason_code EXCEPTION; null_comments EXCEPTION; -- Package Variables -- ----------------- vErrMsg VARCHAR2(1000); vSQL VARCHAR2(2000); -- ---------------------------------------------------------------------------------------------- PROCEDURE Insert_Record (p_t_log tbl_T_Log ) IS BEGIN IF ( NVL(p_t_log.COUNT,0) = 0 ) THEN RAISE null_table; ELSE FOR i IN p_t_log.first .. p_t_log.last LOOP vSQL := 'INSERT INTO .transaction_log (seq_no,table_name,trans_type,trans_key,action' ||',column_name,old_value,new_value,trans_date,user_id,reason_code,comments)' ||' VALUES ( .TRANSACTION_NO_SEQ.nextval'; -- Build Insert Statement IF ( p_t_log(i).table_name IS NOT NULL ) THEN vSQL := vSQL||','''||p_t_log(i).table_name||''''; ELSE RAISE null_table_name; END IF; IF ( p_t_log(i).trans_type IS NOT NULL ) THEN vSQL := vSQL||','''||p_t_log(i).trans_type||''''; ELSE RAISE null_trans_type; END IF; IF ( p_t_log(i).trans_key IS NOT NULL ) THEN vSQL := vSQL||','''||p_t_log(i).trans_key||''''; ELSE RAISE null_trans_key; END IF; IF ( p_t_log(i).action IS NOT NULL ) THEN vSQL := vSQL||','''||p_t_log(i).action||''''; ELSE RAISE null_action; END IF; IF ( p_t_log(i).column_name IS NOT NULL ) THEN vSQL := vSQL||','''||p_t_log(i).column_name||''''; ELSE RAISE null_column_name; END IF; IF ( p_t_log(i).old_value IS NOT NULL ) THEN vSQL := vSQL||','''||p_t_log(i).old_value||''''; ELSE vSQL := vSQL||',NULL'; END IF; IF ( p_t_log(i).new_value IS NOT NULL ) THEN vSQL := vSQL||','''||p_t_log(i).new_value||''''; ELSE RAISE null_value; END IF; --transaction_date vSQL := vSQL||',sysdate'; IF ( p_t_log(i).user_id IS NOT NULL ) THEN vSQL := vSQL||','''||p_t_log(i).user_id||''''; ELSE RAISE null_user_id; END IF; IF ( p_t_log(i).reason_code IS NOT NULL ) THEN vSQL := vSQL||','''||p_t_log(i).reason_code||''''; ELSE RAISE null_reason_code; END IF; IF ( p_t_log(i).comments IS NOT NULL ) THEN vSQL := vSQL||','''||p_t_log(i).comments||''''; ELSE RAISE null_comments; END IF; vSQL := vSQL||')'; dbms_output.put_line('vSQL = '||vSQL); EXECUTE IMMEDIATE vSQL; vSQL := NULL; END LOOP; -- The COMMIT is intentionally left out to force the calling -- application to perform the commit and complies with the -- basics of encapsulation. -- --------------------------------------------------------- END IF; EXCEPTION WHEN null_table THEN vErrMSg := 'The p_t_log Collection cannot be null!'; RAISE_APPLICATION_ERROR(-20990,vErrMsg); WHEN null_table_name THEN vErrMSg := 'Table Name cannot be null!'; RAISE_APPLICATION_ERROR(-20991,vErrMsg); WHEN null_trans_type THEN vErrMSg := 'Transaction Type cannot be null!'; RAISE_APPLICATION_ERROR(-20992,vErrMsg); WHEN null_trans_key THEN vErrMSg := 'Transaction Key cannot be null!'; RAISE_APPLICATION_ERROR(-20993,vErrMsg); WHEN null_action THEN vErrMSg := 'Action cannot be null!'; RAISE_APPLICATION_ERROR(-20994,vErrMsg); WHEN null_column_name THEN vErrMSg := 'Column Name cannot be null!'; RAISE_APPLICATION_ERROR(-20995,vErrMsg); WHEN null_value THEN vErrMSg := 'Value cannot be null!'; RAISE_APPLICATION_ERROR(-20996,vErrMsg); WHEN null_user_Id THEN vErrMSg := 'User ID cannot be null!'; RAISE_APPLICATION_ERROR(-20997,vErrMsg); WHEN null_reason_code THEN vErrMSg := 'Reason Code cannot be null!'; RAISE_APPLICATION_ERROR(-20998,vErrMsg); WHEN null_comments THEN vErrMSg := 'Comments cannot be null!'; RAISE_APPLICATION_ERROR(-20999,vErrMsg); END Insert_Record; -- ------------------------------------------------------------------------------------------------ PROCEDURE Update_Record (p_t_log tbl_T_Log ) IS BEGIN IF ( NVL(p_t_log.COUNT,0) = 0 ) THEN RAISE null_table; ELSE FOR i IN p_t_log.first .. p_t_log.last LOOP vSQL := 'INSERT INTO .transaction_log (seq_no,table_name,trans_type,trans_key,action' ||',column_name,old_value,new_value,trans_date,user_id,reason_code,comments)' ||' VALUES ( .TRANSACTION_NO_SEQ.nextval'; -- Build Insert Statement IF ( p_t_log(i).table_name IS NOT NULL ) THEN vSQL := vSQL||','''||p_t_log(i).table_name||''''; ELSE RAISE null_table_name; END IF; IF ( p_t_log(i).trans_type IS NOT NULL ) THEN vSQL := vSQL||','''||p_t_log(i).trans_type||''''; ELSE RAISE null_trans_type; END IF; IF ( p_t_log(i).trans_key IS NOT NULL ) THEN vSQL := vSQL||','''||p_t_log(i).trans_key||''''; ELSE RAISE null_trans_key; END IF; IF ( p_t_log(i).action IS NOT NULL ) THEN vSQL := vSQL||','''||p_t_log(i).action||''''; ELSE RAISE null_action; END IF; IF ( p_t_log(i).column_name IS NOT NULL ) THEN vSQL := vSQL||','''||p_t_log(i).column_name||''''; ELSE RAISE null_column_name; END IF; IF ( p_t_log(i).old_value IS NOT NULL ) THEN vSQL := vSQL||','''||p_t_log(i).old_value||''''; ELSE vSQL := vSQL||',NULL'; END IF; IF ( p_t_log(i).new_value IS NOT NULL ) THEN vSQL := vSQL||','''||p_t_log(i).new_value||''''; ELSE RAISE null_value; END IF; --transaction_date vSQL := vSQL||',sysdate'; IF ( p_t_log(i).user_id IS NOT NULL ) THEN vSQL := vSQL||','''||p_t_log(i).user_id||''''; ELSE RAISE null_user_id; END IF; IF ( p_t_log(i).reason_code IS NOT NULL ) THEN vSQL := vSQL||','''||p_t_log(i).reason_code||''''; ELSE RAISE null_reason_code; END IF; IF ( p_t_log(i).comments IS NOT NULL ) THEN vSQL := vSQL||','''||p_t_log(i).comments||''''; ELSE RAISE null_comments; END IF; vSQL := vSQL||')'; dbms_output.put_line('vSQL = '||vSQL); EXECUTE IMMEDIATE vSQL; vSQL := NULL; END LOOP; -- The COMMIT is intentionally left out to force the calling -- application to perform the commit and complies with the -- basics of encapsulation. -- --------------------------------------------------------- END IF; EXCEPTION WHEN null_table THEN vErrMSg := 'The p_t_log Collection cannot be null!'; RAISE_APPLICATION_ERROR(-20990,vErrMsg); WHEN null_table_name THEN vErrMSg := 'Table Name cannot be null!'; RAISE_APPLICATION_ERROR(-20991,vErrMsg); WHEN null_trans_type THEN vErrMSg := 'Table Name cannot be null!'; RAISE_APPLICATION_ERROR(-20992,vErrMsg); WHEN null_trans_key THEN vErrMSg := 'Table Name cannot be null!'; RAISE_APPLICATION_ERROR(-20993,vErrMsg); WHEN null_action THEN vErrMSg := 'Table Name cannot be null!'; RAISE_APPLICATION_ERROR(-20994,vErrMsg); WHEN null_column_name THEN vErrMSg := 'Table Name cannot be null!'; RAISE_APPLICATION_ERROR(-20995,vErrMsg); WHEN null_value THEN vErrMSg := 'Table Name cannot be null!'; RAISE_APPLICATION_ERROR(-20996,vErrMsg); WHEN null_user_Id THEN vErrMSg := 'Table Name cannot be null!'; RAISE_APPLICATION_ERROR(-20997,vErrMsg); WHEN null_reason_code THEN vErrMSg := 'Table Name cannot be null!'; RAISE_APPLICATION_ERROR(-20998,vErrMsg); WHEN null_comments THEN vErrMSg := 'Table Name cannot be null!'; RAISE_APPLICATION_ERROR(-20999,vErrMsg); END Update_Record; -- ------------------------------------------------------------------------------------------------ PROCEDURE Delete_Record (p_t_log tbl_T_Log ) IS BEGIN IF ( NVL(p_t_log.COUNT,0) = 0 ) THEN RAISE null_table; ELSE FOR i IN p_t_log.first .. p_t_log.last LOOP vSQL := 'INSERT INTO .transaction_log (seq_no,table_name,trans_type,trans_key,action' ||',column_name,old_value,new_value,trans_date,user_id,reason_code,comments)' ||' VALUES ( .TRANSACTION_NO_SEQ.nextval'; -- Build Insert Statement IF ( p_t_log(i).table_name IS NOT NULL ) THEN vSQL := vSQL||','''||p_t_log(i).table_name||''''; ELSE RAISE null_table_name; END IF; IF ( p_t_log(i).trans_type IS NOT NULL ) THEN vSQL := vSQL||','''||p_t_log(i).trans_type||''''; ELSE RAISE null_trans_type; END IF; IF ( p_t_log(i).trans_key IS NOT NULL ) THEN vSQL := vSQL||','''||p_t_log(i).trans_key||''''; ELSE RAISE null_trans_key; END IF; IF ( p_t_log(i).action IS NOT NULL ) THEN vSQL := vSQL||','''||p_t_log(i).action||''''; ELSE RAISE null_action; END IF; IF ( p_t_log(i).column_name IS NOT NULL ) THEN vSQL := vSQL||','''||p_t_log(i).column_name||''''; ELSE RAISE null_column_name; END IF; IF ( p_t_log(i).old_value IS NOT NULL ) THEN vSQL := vSQL||','''||p_t_log(i).old_value||''''; ELSE vSQL := vSQL||',NULL'; END IF; IF ( p_t_log(i).new_value IS NOT NULL ) THEN vSQL := vSQL||','''||p_t_log(i).new_value||''''; ELSE RAISE null_value; END IF; --transaction_date vSQL := vSQL||',sysdate'; IF ( p_t_log(i).user_id IS NOT NULL ) THEN vSQL := vSQL||','''||p_t_log(i).user_id||''''; ELSE RAISE null_user_id; END IF; IF ( p_t_log(i).reason_code IS NOT NULL ) THEN vSQL := vSQL||','''||p_t_log(i).reason_code||''''; ELSE RAISE null_reason_code; END IF; IF ( p_t_log(i).comments IS NOT NULL ) THEN vSQL := vSQL||','''||p_t_log(i).comments||''''; ELSE RAISE null_comments; END IF; vSQL := vSQL||')'; dbms_output.put_line('vSQL = '||vSQL); EXECUTE IMMEDIATE vSQL; vSQL := NULL; END LOOP; -- The COMMIT is intentionally left out to force the calling -- application to perform the commit and complies with the -- basics of encapsulation. -- --------------------------------------------------------- END IF; EXCEPTION WHEN null_table THEN vErrMSg := 'The p_t_log Collection cannot be null!'; RAISE_APPLICATION_ERROR(-20990,vErrMsg); WHEN null_table_name THEN vErrMSg := 'Table Name cannot be null!'; RAISE_APPLICATION_ERROR(-20991,vErrMsg); WHEN null_trans_type THEN vErrMSg := 'Table Name cannot be null!'; RAISE_APPLICATION_ERROR(-20992,vErrMsg); WHEN null_trans_key THEN vErrMSg := 'Table Name cannot be null!'; RAISE_APPLICATION_ERROR(-20993,vErrMsg); WHEN null_action THEN vErrMSg := 'Table Name cannot be null!'; RAISE_APPLICATION_ERROR(-20994,vErrMsg); WHEN null_column_name THEN vErrMSg := 'Table Name cannot be null!'; RAISE_APPLICATION_ERROR(-20995,vErrMsg); WHEN null_value THEN vErrMSg := 'Table Name cannot be null!'; RAISE_APPLICATION_ERROR(-20996,vErrMsg); WHEN null_user_Id THEN vErrMSg := 'Table Name cannot be null!'; RAISE_APPLICATION_ERROR(-20997,vErrMsg); WHEN null_reason_code THEN vErrMSg := 'Table Name cannot be null!'; RAISE_APPLICATION_ERROR(-20998,vErrMsg); WHEN null_comments THEN vErrMSg := 'Table Name cannot be null!'; RAISE_APPLICATION_ERROR(-20999,vErrMsg); END Delete_Record; -- ------------------------------------------------------------------------------------------------ END Transaction_Log_pkg; ----------------------------------------------------------------------------- -- --------------------------------------------------------------------------------------------------- Secondary forms * (all this coding was limited to the Insert, update or delete buttons.) The following example is the Insert button)
/* When-Button-Pressed Trigger */ DECLARE vBlockName VARCHAR2(20) := 'REPORT_CATEGORIES'; vBlockItem VARCHAR2(61); vCurrItem VARCHAR2(61); nRecCnt NUMBER := 1; /* Here is where you create your Forms Variable TYPEd off the Package Table of Records (ToR) */ /* Since it is a table of records, you could easily add multiple rows to the ToR if your form uses a multi-record block */ p_tlog cir.transaction_log_pkg.tbl_t_log; BEGIN vCurrItem := vBlockName||'.'||Get_Block_Property(vBlockName,FIRST_ITEM); Go_Item(vCurrItem); -- 1. Endure each field if populated. -- 2. Check for Duplicates (Handled in W-V-I) IF ( Name_In(:system.Cursor_Item) IS NULL ) THEN --Fail the form at the field that is NULL send_alert.msg('s','All fields are required. Please enter a unique value.'); RAISE Form_Trigger_Failure; END IF; WHILE ( vCurrItem IS NOT NULL ) LOOP vBlockItem := :system.cursor_item; -- Loop through the block and CALL Insert_Record for each Block Item. /* 1 */ p_tlog(nRecCnt).table_name := vBlockName; /* 2 */ p_tlog(nRecCnt).trans_type := Name_In(vBlockName||'.CAT_TYPE'); /* 3 */ p_tlog(nRecCnt).trans_key := Name_In(vBlockName||'.ID'); /* 4 */ p_tlog(nRecCnt).action := 'INSERT'; /* 5 */ p_tlog(nRecCnt).column_name := substr(vBlockItem,instr(vBlockItem,'.')+1,length(vBlockItem)); /* 6 */ p_tlog(nRecCnt).old_value := NULL; /* 7 */ p_tlog(nRecCnt).new_value := Name_In(vBlockItem); /* 8 */ p_tlog(nRecCnt).trans_date := sysdate; /* 9 */ p_tlog(nRecCnt).user_id := :Global.userid; /*10 */ p_tlog(nRecCnt).reason_code := Name_In(vBlockName||'.REASON_CODE'); /*11 */ p_tlog(nRecCnt).comments := Name_In(vBlockName||'.COMMENTS'); vCurrItem := Get_Item_Property(vBlockItem,NEXTITEM); next_item; nRecCnt := nRecCnt + 1; END LOOP; -- 3. Insert -- Call TRANSACTION_LOG_PKG.Insert_Record -- --------------------------------------
.transaction_log_pkg.insert_record(p_t_log => p_tlog); -- 4. Commit Commit; -- 5. Clear Block Clear_Block(Ask_Commit); -- 6. Close Form Hide_Window('REPORT_CATEGORIES'); -- 7. ReQuery RC_DISP Block Go_Block('REPORT_CATEGORIES_DISP'); Clear_Block(No_Validate); Execute_Query; -- 8. Done END; I knew not when I started this process of forms if she was going to work because I tried to do something similar to this when I was working with Forms 6i and Oracle Enterprise Business Suite and Forms 6i supported not Ref Cursor and Table of documents very well so I didn't know at first if it would work. Search in forms documentation, I found that Forms 10 g has supported this type of functionality and this process works very well and it was surprisingly fast - at least in my usage, it is very fast. :)
I hope this helps.
Craig...If I or someone elses answer was useful, please mark accordingly
-
How to count records in a Table or form
I have a Table that went to my context in the form of ADOBE. I need to be able to count the number of records in this table. I didn't see the actual table in this case on the shape, I just need than the number of records. And, I need to do this using JavaScript and I don't know anything about Java (although if FormCalc works I can use this as well). My Tablename is a customer and in my form, it's in the hierarchy data .main .customerbody .customerline. If I have to have these data in the table on the form, then I can just put it on the form and invisiible. I really need to count the number of records well and return this # to a text field in the form.
Does anyone know how to do this and can you give me an example is Java for FormCalc? The more specific you can be with the example script best for this beginner. THX!
I was no longer complicate things, and I found a simple answer to my problem. I do this on SAP with Livecyle form so here's what I did
In the Interface, I created a global variable called gv_count. I then added, during the initialization of form Interface, copy the following code:
describe the table reservations LINES gv_count.
And then, in the form, I had just to add gv_count to the context and how link this to the field I want to do the count
-
Total number of records in the table read
Here is the procedure to read total no of record in the table specified by the user during execution. But it still gives the same answer for all the table. Can someone help me?
create or replace procedure p3 (varchar2, not on the number tab)
as
Start
Select count (*) from no tab;
end;You need dynamic SQL statements.
Or:
http://laurentschneider.com/wordpress/2007/04/how-do-i-store-the-counts-of-all-tables.html
To get the name of the Table and no lines
http://asktom.Oracle.com/pls/asktom/f?p=100:11:1725645184471282:P11_QUESTION_ID:1660875645686Or simply use the data dictionary, collect statistics of the table, then:
Select table_name, num_rows from user_tables; -
Addign a computed column of the record count in table external
Hello
I have a csv file that is loaded using the external table. My need is to give a number to each record in the file and save it in one of the extra column in the table, can anyone suggest how it is possible?
The structure of the file is:
Now, my need is to give a number to each record... like the record from 7369, SMITH should be granted record n ° 1, 7499, ALLEN should be record No. 2 etc... can anyone suggest how it is possible?$cat emp.txt 7369,SMITH,CLERK,7902,12/17/1980,800,,20 7499,ALLEN,SALESMAN,7698,2/20/1981,1600,300,30 7521,WARD,SALESMAN,7698,2/22/1981,1250,500,30 7566,JONES,MANAGER,7839,4/2/1981,2975,,20 7654,MARTIN,SALESMAN,7698,9/28/1981,1250,1400,30 7698,BLAKE,MANAGER,7839,5/1/1981,2850,,30 7782,CLARK,MANAGER,7839,6/9/1981,2450,,10 7788,SCOTT,ANALYST,7566,12/9/1982,3000,,20 7839,KING,PRESIDENT,,11/17/1981,5000,,10 7844,TURNER,SALESMAN,7698,9/8/1981,1500,0,30 7876,ADAMS,CLERK,7788,1/12/1983,1100,,20 7900,JAMES,CLERK,7698,12/3/1981,950,,30 7902,FORD,ANALYST,7566,12/3/1981,3000,,20 7934,MILLER,CLERK,7782,1/23/1982,1300,,10 --and the table structure is: CREATE TABLE TMP_emp_ext ( EMPNO NUMBER(4), ENAME VARCHAR2(10), JOB VARCHAR2(9), MGR NUMBER(4), HIREDATE DATE, SAL NUMBER(7,2), COMM NUMBER(7,2), DEPTNO NUMBER(2) ) ORGANIZATION EXTERNAL ( TYPE ORACLE_LOADER DEFAULT DIRECTORY DIR_N1 ACCESS PARAMETERS ( records delimited by newline fields terminated by ',' missing field values are null ) LOCATION (DIR_N1:'emp.txt') ) REJECT LIMIT UNLIMITED NOPARALLEL NOMONITORING /
Thank you
orausernT. Kyte write RECNUM should work in http://asktom.oracle.com/pls/apex/f?p=100:11:0:P11_QUESTION_ID:52733181746448 #52977916329285 because it is SQL * Loader syntax. However I've wasn't able to make it work with Oracle 10.2.0.4. But in case of errors of loading, you should find in
_XXXXX.log the number of rejected records line (in my example it's the meaning of the 'line 2' "line 2"): erreur lors du traitement de la colonne EMPNO, la ligne 2, pour le fichier de données /tmp/emp.txt ORA-01722: invalid number
-
delete all the records in a table, the speed of insertion is not change.
I have an empty table, and I insert a record need 100ms.
During this table a 40,0000 trace, I insert a record need 1 s, it's ok, because I need to make a comparison according to an index before inserting a record need, so more record, more time.
The problem is when I delete all the record in this table, the insertion time is always 1s, not reduce to 100ms. Why?Hello
Read this part of the oracle documentation
http://download.Oracle.com/docs/CD/B19306_01/server.102/b14220/logical.htm#CNCPT004
The reason is always 1s, because when you inserted 400ko record as HWM (high tide is the border between old and new space in a segment.) moved to the top. And when you remove all records of your HWM still in the same coordinate system and that you have not reset to 0. So when you insert 1 it save free space and after finding faces (usually a regular insertions got 6 steps it inserts data). If you truncate your table you and try it again it will be faster that your HWM is reset to 0.
Concerning
-
Hello, I have problems with my Microsoft Lifecam 5000. Whenever I'm recording video with her, during playback, I hear clicking on and a beep sound when the camera is focusing. If I put it to my ear, the sound is low but I can still here it when it focuses.
Hello
Thanks for posting in the Microsoft Community Forum.
I understand from your description, that you get beep when the camera is focusing.
To better understand the question, please answer the following questions:
1. have you made changes on the computer before this problem?
2. is it works much earlier?Come back with more information to help you better.
I suggest you to download and install the latest drivers for Microsoft Lifecam 5000 from the link provided:
http://www.Microsoft.com/hardware/en-us/d/LifeCam-VX-5000
You can even try recording by reducing the volume on the computer to the minimum level (mute) just to check if beep occurs.
http://Windows.Microsoft.com/en-us/Windows7/adjust-the-sound-level-on-your-computer
For more information, see the link below:
http://www.Microsoft.com/hardware/en-us/help/support/troubleshooting/webcam/LifeCam-Setup
Hope the above information is helpful. If you have any question back to us, we are happy to help you.
Thank you.
-
Use with need to collect in bulk to insert records from multiple tables
Hello
I plsql record type with several tables with multiple columns. so when I used bulk collect with education for ALL. I want to insert records in multiple tables.
Please give me suggestions.
ForAll is designed to be used with a single DML statement, which may include dynamic SQL statements. However, I do not know what advantage this will give you your list iteration save several times, one for each table - especially since there is an air show with SQL dynamic.
Example 1 (dynamic SQL):
begin
...
forall i in vRecList.First..vRecList.Last
execute immediate '
begin
insert into Table1 (Col1, Col2, Col3) values (:1, :2, :3);
insert into Table2 (Col1, Col2, Col3) values (:1, :2, :3);
end;' using vRecList(i).Col1, vRecList(i).Col2, vRecList(i).Col3;
end;Another approach that I should work (but not tested) is using to insert all the Scriptures and based record inserts, but you need to try on your version of Oracle forall has changed between the versions. In this case vRecList must be compatible with the Table % ROWTYPE and Table2% ROWTYPE type.
Example 2 (insert all):
begin
...
forall i in vRecList.First..vRecList.Last
insert all
into Table1 values vRecList(i)
into Table2 values vRecList(i)
select 1 from dual;
end; -
Matching records between 2 tables with duplicate records
Hi all
I need help in what follows.
I have 2 tables Received_bills and Send_bills.
-------------------------------------------------------
-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),
VARCHAR2 (5 BYTE) 'STATUS' ) ;
INSERTION of REM in RECEIVED_BILLS
TOGETHER TO DEFINE
Insert. RECEIVED_BILLS (DATUM, PAYMENT, CODE, STATE) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1', 'SUCCESS');
Insert into RECEIVED_BILLS (PAYMENT, CODE, DATE, STATUS) values (to_date('10-OCT-15','DD-MON-RR'), 'A5', 'SUCCESS', 25);
Insert into RECEIVED_BILLS (PAYMENT, CODE, DATE, STATUS) values (to_date('10-OCT-15','DD-MON-RR'), 47, 'A4', 'FAILED');
Insert into RECEIVED_BILLS (PAYMENT, CODE, DATE, STATUS) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1', 'FAILED');
Insert into RECEIVED_BILLS (PAYMENT, CODE, DATE, STATUS) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1', 'SUCCESS');
INSERTION of REM in SEND_BILLS
TOGETHER TO DEFINE
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'), 25, 'A5');
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');
I match all records of send_bills and received_bills with a status of 'SUCCESS' There is no single column in the table.
Correspondence held payment of columns, the code and the scratch cards, but it may also duplicate records. But even if there are duplicates, I also need those records in the query results
the query I wrote is this:
SELECT SEND.*
REC received_bills, send_bills send
WHERE send.datum = rec.datum
AND send.payment = rec.payment
AND send.code = rec.code
AND 'rec.status =' SUCCESS
;
The query results give me this
OCTOBER 10, 15 19 A1 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 25 A5 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 25 A5 The result of the correct application would be
OCTOBER 10, 15 19 A1 OCTOBER 10, 15 25 A5 OCTOBER 10, 15 19 A1 The select statement that I need I want to use a loop to insert records in another table.
Can someone help me please?
Thanks in advance.
Best regards
Caroline
Hi, Caroline.
Caroline wrote:
Hi all
I need help in what follows.
I have 2 tables Received_bills and Send_bills.
-------------------------------------------------------
-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),
VARCHAR2 (5 BYTE) 'STATUS');
INSERTION of REM in RECEIVED_BILLS
TOGETHER TO DEFINE
Insert. RECEIVED_BILLS (DATUM, PAYMENT, CODE, STATE) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1', 'SUCCESS');
Insert into RECEIVED_BILLS (PAYMENT, CODE, DATE, STATUS) values (to_date('10-OCT-15','DD-MON-RR'), 'A5', 'SUCCESS', 25);
Insert into RECEIVED_BILLS (PAYMENT, CODE, DATE, STATUS) values (to_date('10-OCT-15','DD-MON-RR'), 47, 'A4', 'FAILED');
Insert into RECEIVED_BILLS (PAYMENT, CODE, DATE, STATUS) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1', 'FAILED');
Insert into RECEIVED_BILLS (PAYMENT, CODE, DATE, STATUS) values (to_date('10-OCT-15','DD-MON-RR'), 19, 'A1', 'SUCCESS');
INSERTION of REM in SEND_BILLS
TOGETHER TO DEFINE
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'), 25, 'A5');
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');
I match all records of send_bills and received_bills with a status of 'SUCCESS' There is no single column in the table.
Correspondence held payment of columns, the code and the scratch cards, but it may also duplicate records. But even if there are duplicates, I also need those records in the query results
the query I wrote is this:
SELECT SEND.*
REC received_bills, send_bills send
WHERE send.datum = rec.datum
AND send.payment = rec.payment
AND send.code = rec.code
AND 'rec.status =' SUCCESS
;
The query results give me this
OCTOBER 10, 15 19 A1 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 25 A5 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 19 A1 OCTOBER 10, 15 25 A5 The result of the correct application would be
OCTOBER 10, 15 19 A1 OCTOBER 10, 15 25 A5 OCTOBER 10, 15 19 A1 The select statement that I need I want to use a loop to insert records in another table.
Can someone help me please?
Thanks in advance.
Best regards
Caroline
Want to get answers that work? Then make sure that the CREATE TABLE and INSERT statements you post too much work. Test (and, if necessary, correct) your statements before committing. You have a stray "." in the first INSERT statement for received_bills and receikved_bills.status is defined as VARCHAR2 (5), but all values are 6 characters long.
There are 5 lines in send_bills that are similar to the
10 OCTOBER 2015 19 A1
Why do you want that 2 rows like this in the output, not 1 or 3, or 4 or 5? Is it because there are 2 matching rows in received_bills? If so, you can do something like this:
WITH rec AS
(
SELECT the reference, payment, code
, ROW_NUMBER () OVER (PARTITION BY datum, payment, code)
ORDER BY NULL
) AS r_num
OF received_bills
Situation WHERE = 'SUCCESS'
)
send AS
(
SELECT the reference, payment, code
, ROW_NUMBER () OVER (PARTITION BY datum, payment, code)
ORDER BY NULL
) AS r_num
OF send_bills
)
SELECT send.datum, send.payment, send.code
REC, send
WHERE send.datum = rec.datum
AND send.payment = rec.payment
AND send.code = rec.code
AND send.r_num = rec.r_num
;
Note that the main request is very similar to the query you posted, but the last condition has changed.
If you need to insert these lines in another table, you can use this query in an INSERT statement. There is no need of a loop, or for any PL/SQL.
-
Quick loss of millions of records in a table with version
Hello world
We seek for one of our tables versioned delete and contains about 28 million records. On Exadata and 11.2.0.3.
Normally we would just drag the table, but there is a requirement that we keep a number of documents (about 500 k), complete with the story, so that other components of the system related are not lacking (even if these 500 k will also be removed subsequently).
I did a survey on how we can do that, but a massive factor is to ensure that there is minimal downtime. A method I've tried is to remove batch of 5 million - if the button Delete merging could take 24 hours in total for each series and we could not afford 6 cases of this.
I also tried DBMS_WM. PURGETABLE, but this seems to take a long time as well (even with no table to archive being created).
Copies the records in another table LT, truncate table source and re - insert the records back in 500 k is an option that we looked at, if not ideal. I think we would also update wm$ modified_tables for it.
Are there other alternatives that make this possible, or if we were to go down the road of truncated - is there anything else we need to consider in order to maintain the coherence of the WMSYS dictionary?
Many thanks in advance,
James
Hi James,
Would it not possible to simply do the operation to remove directly in LIVE workspace? This would eliminate the need to merge the workspace. Truncation operations do not rely on the tables of the activated version. Nor is face _LT table to a temporary table and the re-insertinig. The hierarchy of the workspace and other metadata may have changed in the meantime which would make it invalid reinserted data. Guaranteeing that nothing else changes it would fix, but is not yet all that is generally supported.
Delete that number of lines will take some time little matter method. How long the procedure PurgeTable did? It is going to be the approach that should be faster by using features of the Workspace Manager. In addition, if these lines will be deleted anyway, why not just wait until it is safe to do so and do it all at this point in time? Then you must conditionally delete lines. You can simply call dbms_wm. DisableVersioning on the table and then delete it.
Kind regards
Ben
Maybe you are looking for
-
Hey guys, have a slight problem with my Cd burner on my l10, I am trying to burn audio and when I burn all the securities on a blank cd the first seconds of each track seems to ignore. I tried two different blank CD, a JVC and another one not a mark.
-
Satellite L50 - B suddenly does not recognize USB devices
Suddenly my laptop does not recognize any USB. The USB key or external hard drive works on other computers, but not on my laptop.Only cards SD-are recognized. I tried to remove the usb portals on the Control Panel, but after I restarted my computer a
-
Lenovo D221 lcd screen out of sync with x 61 Tablet in office extended to higher resolution.
When I connect the tablet screen, the image is moved to the right. The lcd display is connected to the Tablet using the analog output connected to the analog input of the monitor. Presentation Director allowed me to fix the two monitors at their nati
-
Remove labview 2009 without using Add/Remove program
Hi all I have problem with the removal of LabVIEW 2009. I deleted some folders in the C drive, folder OR. Now I can't start my LabVIEW 2009 and it does not appear in my Add/Remove Programs list. I tried to delete all the folders and files in the C dr
-
What is the problem when my Tablet always gives me message "your device battery is too hot, if it please shut it down & let it cool for a while even if I just used it for 15 minutes. Thanks for your help.