SQL & PL/SQL :: How To Check Record Exists Validation
Jan 18, 2011
1. Below TXN_LOG table Expected to have 0.5 to 1 million records & TXN_LOG_HIST table will have max 3 million records.
2. On daily basis system will move records from TXN_LOG to TXN_LOG_HIST.
3. The below mentioned check will be performed for each transaction, With out this check currently my process is doing 10tps. (transaction per second).
CREATE TABLE TXN_LOG
(
REFNO VARCHAR2(16) PRIMARY KEY,
LOCATION VARCHAR2(3),
AC_NO VARCHAR2(20),
TXN_INIT_DATE DATE,
AMOUNT NUMBER(22,3),
[code]....
The below validation we are currently using which is overhead for our transactions processing. Also the below mentioned check will be performed for each transaction, With out this check currently my process is doing 10tps. (transaction per second).
BEGIN
SELECT COUNT(1)
INTO l_exists
FROMTXN_LOG
WHERE AC_NO = p_acho
TXN_INIT_DATE = p_txn_date
AMOUNT = p_amt
[code]....
Is there any fastest method to check above record exists validation from the both the table?
View 11 Replies
ADVERTISEMENT
Aug 12, 2012
Using a cursor and loop method records are inserted into the header and line tables. How do I code the IF statement prior to the INSert statement such that Insert if record does not exist else Update the record. If the record for insert fails in the line, the same record should be deleted from the header table as well and transaction should rollback. The Ora version used is 11.2.0.2.
CURSOR C1 IS
SELECT H.*
FROM rex_head_extract h
WHERE TRUNC(h.create_date) BETWEEN v_begin_date AND v_end_date;
FOR I IN C1 (v_begin_date, v_end_date)
[Code]....
--- Need to perform a check if record exists here prior to insert
INSERT INTO tran_head
(TRAN_SEQ_NBR, ORG_NUMBER,
STORE_NUMBER, TRAN_DATE,
[Code]....
View 9 Replies
View Related
Jun 18, 2013
i have a procedure like create or replace procedure studrec( a in sid%rowtype)asi sid%rowtype;beginselect sid into ifrom students; i need to check whether sid is exist in the variable i or not
View 5 Replies
View Related
Feb 6, 2013
I have created/added one new RAC database.What post validation check has to be performed after creating new Database.
Note: already there is one DB exist in the server.
View 4 Replies
View Related
Oct 12, 2005
I have a script like this:
------------------------------------------------------------
DROP TABLE CON_TEST CASCADE CONSTRAINTS ;
CREATE TABLE CON_TEST (
IDI NUMBER(10,0),
USERID VARCHAR2(10),
PWD VARCHAR2(10),
NOTE VARCHAR(100)
)
----------------------
But i think if table CON_TEST doen't exist, an error message will appear. I know that in SQL Server we can check if table exists or not. So, i wonder if we can do that in Oracle?
By the way, is there any way to run a file script that contents TABLES, STORED, ... on a developed PC connect to oracle db server? (in case, i'm developing on PC, using Net Service Name to conect to Oracle DB Server)
View 9 Replies
View Related
Jan 19, 2010
I have a table called TRANS, and a primary key field tran_id. How would i check if there is a record matching tran_id 'DUP7927' ?
View 25 Replies
View Related
Aug 14, 2012
As per the earlier post,I am able to parse now.
i have also another concern as per below xml file.
My requirement is to identify perticular node ,whose having PriorValue attribute present in <pi:the Actual_Comp_Change> tag,those record should return.
<?xml version="1.0" encoding="UTF-8"?>
<pi:Extract_Employees xmlns:pi="urn:com.workday/picof">
<pi:Employee>
<pi:Employee_ID>1100</pi:Employee_ID>
[Code]....
OUTPUT:
EmployeeID_ Name JobTitle_ Grade ActualComp_Change_
1100 Surana Intern - Master¿s A 500000
1000 roy Intern - Master¿s B 216000
1000 roy Intern - Master¿s 00 266000
But my requirement is to display only those employeeID ,where Actual_Comp_Change tag having PriorValue attribute.
The required OutPUT should be :
EmployeeID_ Name JobTitle_ Grade ActualComp_Change_
1100 Surana Intern - Master¿s A 500000
is there any possibility to use ExistNode() function to the above quer or is there any alternative solution.
View 5 Replies
View Related
Mar 29, 2013
How can I create a trigger to check if synonym already exists in db and if exists then don't create synonym.
my work: ( this is just like an outline i prepared)
select * from all_synonyms;
declare
s_exists number;
begin
-- check whether the synonym exists
select 1 into s_exists from all_synonyms;
-- an error gets raise if it doesn't
exception when no_data_found then
-- DDL has to be done inside
execute immediate ' create or replace synonym';
end;
/
View 16 Replies
View Related
Jan 22, 2013
Which is the best way to check whether a record exists.
DECLARE
l_count NUMBER;
BEGIN
SELECT COUNT(*) INTO l_count FROM emp WHERE empno=7839;
IF l_count=1 THEN
dbms_output.put_line('exists');
ELSE
dbms_output.put_line('not exists');
END IF;
END;
[Code]...
View 7 Replies
View Related
Sep 7, 2011
I am manually committing the form by writing commit statement in key - commit trigger for some reason.
Everything is working fine. I want to display a message if some necessary fields are not filled properly, like if a user filled half table and mistakenly he press the commit button. Here I want to show him a message that you can't saved the data because the table is not completely filled.
View 17 Replies
View Related
Feb 13, 2013
Usually we check 1 row of data in table and compare if they exist, i want to compare different set of row all together to comapre and take the decisions
eg.
emp table_source
d_key emp_no invol
1 103499 1
1 99262 2
2 103499 1
3 103499 1
3 99262 2
target table
emp_no invol
103499 1
99262 2
103499 1
in the above example i have to check for d_key for set of row exist in target or not, so by above example d_key 1 and 3 has save value in 2 different rows so i want to check if the combination of rows
103499 1
99262 2
as a set appear in source then do nothing else insert so first time d_key 1 both records will insert but for d_key has same set in 2 rows will not be inseted. the number of row can be more than 2 also . so for the given key if we have 3 rows in source then i have to compare all the 3 same set of row in target exist of . in the target i don't have any extra column.
View 3 Replies
View Related
Jun 22, 2010
i want to check cursor having record or null/ if having records then count of records?
View 5 Replies
View Related
Mar 13, 2013
I have a multi-record block with several text items.
On one of the text items i want to enter a value and then check whether the same value for the item has already been entered on any other records within the block.
If it has already been entered then i want to display a message and null out the field.
I have tried using app_record.for_All_records from a when-validat-item trigger but this does not work as you get a 'FRM-40737 Illegal restricted procedure go_block in when-validate-item trigger ' error
View 17 Replies
View Related
Jul 30, 2011
I want to put one check box to check all the check boxes.how can i do this?
View 5 Replies
View Related
May 27, 2013
I have data stored in the format 01.01 , 01.02,02.03 in one field of table , i dont want my user to deviate from this coding by not typing like 0001.01 or anything othen than above format , how can i prevent this.
CREATE TABLE OM_AIC_SALES_CODES ( SALE_CODE VARCHAR2(6),SALE_DESC VARCHAR2(240),SALE_MIN_WT NUMBER, SALE_MAX_WT NUMBER)
insert into om_aic_sales_codes ( SALE_CODE ,SALE_DESC ,SALE_MIN_WT , SALE_MAX_WT ) values ('01.01','Extra Light <= 30 kg/m',NULL,NULL);
insert into om_aic_sales_codes ( SALE_CODE ,SALE_DESC ,SALE_MIN_WT , SALE_MAX_WT ) values ('01.02','Light >30 <=60 kg/m',NULL,NULL);
--i dont want the following inserts to happen or invalid inserts.
insert into om_aic_sales_codes ( SALE_CODE ,SALE_DESC ,SALE_MIN_WT , SALE_MAX_WT ) values ('01.003','Light >30 <=60 kg/m',NULL,NULL);
insert into om_aic_sales_codes ( SALE_CODE ,SALE_DESC ,SALE_MIN_WT , SALE_MAX_WT ) values ('001.003','Light >30 <=60 kg/m',NULL,NULL);
insert into om_aic_sales_codes ( SALE_CODE ,SALE_DESC ,SALE_MIN_WT , SALE_MAX_WT ) values ('0001','Light >30 <=60 kg/m',NULL,NULL);
View 6 Replies
View Related
Dec 19, 2010
I have two date fields in my form one start date and the other is end date.I have changed their properties to datetime and set the initial value $$dbdatetime$$ and format mask to dd/mm/rrrr 24HH:MM , what i want is
1.i want to display the A.M and P.M along with that.
2.If the time and date of end dt is lesser than start error must come.
3.If the user enters the P.M during the day time before noon then it should give error message.
View 2 Replies
View Related
Aug 29, 2012
I have a question i wanted to know that " Is it possible to write the Following Query Using NOT EXISTS
SELECT * FROM DEPT WHERE DEPTNO NOT IN (SELECT UNIQUE DEPTNO FROM EMP);
And one more doubt is there, can we use join to get same result.
View 9 Replies
View Related
Jun 11, 2004
I had used a When-Validate-Item trigger against an text item.
Also i had a push button (EXIT) for Exiting from the Form with code : Exit_Form(no_validation);
But if an invalid text is entered in the Text-Item and after that if i use the EXIT push Button then it doesnot exit from the Form till a valid text is entered inside the Text-Item.
how to Exit from Form even if the Text-Item has Invalid Value.
View 3 Replies
View Related
Jul 21, 2010
In our company we have a requirement to export data out of a live dbs and import that into a test db for issue replication,debugging & fixing from time to time.
As a junior DBA am resposible to import a dump file provided to me into a test DB. The export is taken off by customer dbas or consultants for a specified list of tables/schemas etc.
I have readonly access to source database and the issue I am facing is after the import there are certain objects that get missed out or do not get imported properly.
I would like to know if there was a script I can use to generate a report on the source DB and then run the same on the target DB after the import and compare to find out if any objects got missed out.
View 7 Replies
View Related
Jun 5, 2013
create TABLE pan_number(pan CHAR(10) NOT NULL);
INSERT INTO pan_number(pan) VALUES('ABCDE1234A');
INSERT INTO pan_number(pan) VALUES('FGHIG5678F');
INSERT INTO pan_number(pan) VALUES('ABCDE12345');
INSERT INTO pan_number(pan) VALUES('ABCD1234A');
select * from pan_number;
now i need to validate valid PAN number which is of " The first 5 letters should be alphabets & last letter as alphabet & total length of PAN no. should be 10 digit"
i need to display valid PAN number , only first two rows are valid PAN numbers.
View 12 Replies
View Related
Jun 25, 2010
I'm trying to create a external table column validation.
I have data like this
First column is Numeric, second is Non-Numeric
1,X
2,Y
3,Z
There are chances that I may have data as following
1,X
2A,Y
3,Z
My requirement is whenever I get non-numeric data in first column I want to pass 0 or NULL. So, I have created a external table with following script.
CREATE TABLE EXT_test
(
SL NUMBER (4),
BRANCH_NAME VARCHAR2 (100)
)
ORGANIZATION EXTERNAL
(
[code]........
Following is the code for function is numeric
function isnumeric( p_string in varchar2) return boolean as
l_number number;
begin
l_number := p_string;
return TRUE;
exception
when others then
return FALSE;
end;
It is not recognizing function IS NUMERIC. Is there any way, I can do this through External Table.
I'm getting error like
The following error has occurred:
ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-00554: error encountered while parsing access parameters
KUP-01005: syntax error: found "identifier": expecting one of: "comma, date_format, defaultif, enclosed,
(, ltrim, lrtrim, ldrtrim, notrim, nullif, optionally, ), rtrim, terminated"
KUP-01008: the bad identifier was: isnumeric
KUP-01007: at line 9 column 16
ORA-06512: at "SYS.ORACLE_LOADER", line 14
ORA-06512: at line 1
View 1 Replies
View Related
Feb 18, 2007
Has any one written the validation code for
IP Address...
i.e it should be any thing from 0.0.0.0 to 255.255.255.255
View 6 Replies
View Related
Jun 5, 2012
CREATE TABLE TEST ( CREDIT_BALANCE VARCHAR2(11 BYTE), AWARDS_BALANCE VARCHAR2(11 BYTE) )
Insert into TEST(CREDIT_BALANCE, AWARDS_BALANCE)
Values ('1678.09', '1678.9');
Insert into TEST(CREDIT_BALANCE, AWARDS_BALANCE)
[Code]....
From valid records from test table those two columns,need to be insert into test1 table. We should validate the decimal values while selecting from test table.
using regexp.
View 26 Replies
View Related
Aug 3, 2009
i see in my alert.log this message:
Errors in file /oracle/BWP/saptrace/usertrace/bwp_ora_2728058.trc:
ORA-01114: IO error writing block to file 1030 (block # 602122)
ORA-27063: number of bytes read/written is incorrect
IBM AIX RISC System/6000 Error: 28: No space left on device
Additional information: -1
Additional information: 180224
But this file_id i don't have in my database, i am making these queries:
SQL> select FILE_ID from dba_temp_files order by FILE_ID;
FILE_ID
----------
1
2
3
4
5
6
7
8
9
[code]....
I don't have this file_id, why alert.log is showing me it? Of course, nobody has created this datafile and nobody has removed it too.
View 11 Replies
View Related
Feb 21, 2013
We have a 10g environment with DataGuard running for reporting purposes. Our application team is getting ready to upgrade their application and it requires that several SQL Scripts be run to perform the primary database updates. A couple of them are over 1 MB in length. My concern is that these scripts will break DataGuard. I am not a DBA by any stretch, but I seem to remember there are certain limitations with DataGuard.
I have reached back to the team and asked them to have the Vendor confirm these scripts are validated for a DataGuard environment and I have also reached out to the System DBAs for review. I am wondering if there is an utiility available that can check the SQL to confirm if there are any DDL or DML statements that will not work in DataGuard. Likewise, we are going to run these scripts in a non-production DataGuard enabled environment first, but I want to have some level of confidence, that this will be a success.
View 3 Replies
View Related
Aug 12, 2010
I have a time field which i need to validate for military time. for example like e.g.1630. Time entered outside of military time range should not be permitted e.g. 1364, 2510.
View 4 Replies
View Related
Oct 31, 2011
I have one column Value his Datatype is varchar2 and I want to validate it with Type column his values are(Char,Date,Number). If Column Type have value Number then column value should accept number input only. How we 'll achieve this.
View 3 Replies
View Related
Mar 7, 2011
I have a Situation for Date and Time Validation.
I have 4 fields, d1,d2,t1,t2 all are date datatype
I have 1 field for R1 for resource a varchar datatype
1. d1 and d2 for date
2. t1 and t2 for time.
The User enter d1 and d2, t1 and t2
eg 01-03-2011 - > d1
01-03-2011 - > d2
9:00 - > t1
9:30 - > t2
and 'Room1' - R1 for resource.
any other entry having the same data, or have partial data should not be allowed.
like on 01-03-2011 between 9:29 to : 9:40 or even 8:30 to 9:01 on the same date or (replicated dates boundaries) should not be allowed.
View 2 Replies
View Related
Sep 17, 2012
my employer wants me to create an application that will respect our accessibility rules. I know APEX 4.1.1 do it far better then APEX 3.2, but this is our current version.
Do you know any way to tweak how APEX 3.2 show the error messages on the fields after the validation have been executed ?We must show the error messages before the field's caption.
And, if I use the native validation process of 3.2, will it be upgraded to 4.1.1 when we do the move without any actions ?
View 0 Replies
View Related
Mar 30, 2012
following is a query which i find difficult to understand why EXISTS is failing. There are two scenarios where if i block LINE 30 and unblock line 31 of the code then one record is returned.
SELECT A.ENTITY_CODE,
A.VRNO,
A.VRDATE,
[Code]....
View 4 Replies
View Related