How To Validate A Sum Of Some Records In A Table To Be Exact Value

Apr 9, 2008

How to validate a sum of some records in a table to be exact value?

I want to guarantee that sum(val_column)=100 at database level. Check constraints out of question. Trigger before update statement disable any update to that column when incrementing one row and decrement another... (unless with for all...)

View 3 Replies


ADVERTISEMENT

Forms :: Validate Item Value In Multiple Records?

Nov 4, 2013

This is my first post in the form and also i'm new to oracle forms technology.

I have the following issue:

In my form i have two Text-Fields to store some information for a claim:

A --> Profit and
B --> Loss
(only one of the filed can have value)

Also i have a data block where i store the reason of the claim (status). Reason can take three values 1, 2, 3. For each claim i can have more than one reasons stored in db table.

if the user input more than one reasons, then if one of them is 1 Profit should be set unprotected and Loss should be set to protected.

I have the following issue.

user creates a records with reason 1 : Profit text field is set to unprotected and Loss text filed is set protected.

user creates another record with reason 2: Profit text field is set to Protected and Loss text filed is set to unprotected. --> wrong

How can i validate the values of the two records and create the desired functionality?

I have used the POST-TEXT-ITEM trigger but it works correct only for one record. i insert two records with the above order i have the issue i describe.

View 3 Replies View Related

SQL & PL/SQL :: Get Exact Value From Table

Aug 16, 2010

I want to writa a query to fetch the INCOME TAX RATE from the given table, my calculated gross salary amount is 594000

FromAMT ToAMT Rate
------- ------ ----
300001 350000 0.75
350001 400000 1.50
400001 450000 2.5
450001 550000 3.5
5500001 650000 4.50

and so on...

View 3 Replies View Related

SQL & PL/SQL :: Possible To Get Exact Name Of Constraint From Any System Table

Sep 1, 2010

There was one constraint define on the column of table that the value of column should be in range of 100 to 200. Some one has deleted the constraint. Is it possible to get the exact name of constraint from any system table.

View 7 Replies View Related

How To Create Exact Copy Of A Table

Nov 24, 2012

I must admit my "google skills" have failed me and it is possible that I might be missing something obvious here but allow me to explain.

If I have a table that is populated/accessed by a typical OLTP application such that over time the data in the table may become "fragmented".

I know that is a very controversial term I used but that is not the question here. A simple way to describe the state of the table might be that the table has always been populated with lots of small INSERTs, modified with lots of small UPDATEs and data has been deleted in small DELETEs.

This has meant that the data is neither closely stored in data blocks nor is in any particular order (so there are some empty blocks under HWM).

Now my question is how do I create exact copy of this table and its indexes AS THEY EXIST AT THE MOMENT that includes

1) its data
2) its constraints/indexes etc.
3) its storage parameters
4) data stored in EXACTLY same manner as in original table.

To avoid complications, the table in question is just a normal heap table without any partitioning involved. While

CREATE TABLE AS SELECT (or CREATE TABLE followed by INSERT) will take care of points (1) to (3) above, it will not achieve point (4) above.

View 11 Replies View Related

Exact Space Occupied By A Table With LOB Column

Oct 18, 2013

I need to check the exact amount of space used (in bytes or MB) by a table which is having a BLOB column.I tried the following query but it is not giving the proper usage. 

select segment_name , sum(bytes)from dba_extentswhere segment_type='TABLE'and segment_name in ('TEST_CLOB','TEST_BLOB','TEST_CLOB_ADV','TEST_BLOB_ADV') group by segment_name; I even tried the following stored procedure  create or replace procedure sp_get_table_size (p_table_name varchar2)as    l_segment_name          varchar2(30);     l_segment_size_blocks   number;     l_segment_size_bytes    number;     l_used_blocks           number;      l_used_bytes            number;      l_expired_blocks        number;      l_expired_bytes         number;      l_unexpired_blocks      number;      l_unexpired_bytes       number;    begin    select
[code].......

But it is giving the error

Error starting at line 298 in command:exec sp_get_table_size ('TEST_CLOB_ADV')Error report:ORA-03213: Invalid Lob Segment Name for DBMS_SPACE packageORA-06512: at "SYS.DBMS_SPACE", line 210ORA-06512: at "SYS.SP_GET_TABLE_SIZE", line 20ORA-06512: at line 103213. 00000 -  "Invalid Lob Segment Name for DBMS_SPACE package"*Cause:    The Lob Segment specified in the DBMS_SPACE operation does not exist.

*Action:   Fix the Segment Specification Although the LOB section is specified in create table syntax.

View 4 Replies View Related

PL/SQL :: How To Validate Table Data

Aug 13, 2012

I have a table data like this

"VchrNo" "Credit/Debit type" "Amount"
101 1 100.00
101 2 10.00
101 2 10.00
101 2 51.00
101 2 29.75

This data is wrong. Actual DAta should be in any form. But Sum of VchrNo 101 with Credit/Debit Type 1 should be 100 and VchrNo 101 with Credit/Debit Type 2 should be 100 Now this data is begin entered from so many forms.

Is there any way to stop this and raise any error at database level so that culprit form can be found.

View 12 Replies View Related

Forms :: How To Validate Salary Regarding To Its MIN And MAX Value From Another Table

Jun 16, 2012

I have a created data block using employees table so am trying to validate item salary using max_salary and min_salary from table jobs how to do this kind of validation.

[How can i validate input number into a Field of type char in oracle form?]

View 1 Replies View Related

SQL & PL/SQL :: Oracle 10g - Update Records In Target Table Based On Records Coming In From Source

Jun 1, 2010

I am trying to update records in the target table based on the records coming in from source. For instance, if the incoming record is present in the target table I would update them in the target else I would simply insert. I have over one million records in my source while my target has 46 million records. The target table is partitioned based on calendar key. I implement this whole logic using Informatica. Looking at the informatica session log I find that the informatica code is perfectly fine but its in the update part it takes long time (more than 5 days to update one million records). find the TARGET TABLE query and the UPDATE query as below.

TARGET TABLE:
CREATE TABLE OPERATIONS.DENIAL_REGRET_FACT
(
CALENDAR_KEY INTEGER NOT NULL,
DAY_TIME_KEY INTEGER NOT NULL,
SITE_KEY NUMBER NOT NULL,
RESERVATION_AGENT_KEY INTEGER NOT NULL,
LOSS_CODE VARCHAR2(30) NOT NULL,
PROP_ID VARCHAR2(5) NOT NULL,
[code].....

View 9 Replies View Related

SQL & PL/SQL :: How To Calculate Exact Age

Oct 21, 2011

How to calculate exact age for example my date of birth is 10-04-1972 and today current date is 21-10-2011 so i want to calculate age how many years, how many months and how many days.

View 27 Replies View Related

Get Exact Value Without Changing Datatype?

Nov 23, 2011

I created a table of Number(20,4) column. I inserted an amount value 999999999999999.5555 but this value is rounded off to 1000000000000000.0000 automatically in Oracle. How to avoid this? I tried for less number of digits and I am getting the exact value. Is there any way to get the exact value without changing the datatype?

View 1 Replies View Related

SQL & PL/SQL :: Get Exact Matching String

Dec 11, 2012

When I pass the input as 'micky', then i should get the count of records as 4. I tried to use REGEXP_LIKE, but could not get the result.

Test Case:

DROP TABLE test1;
CREATE TABLE test1( pattern_series VARCHAR2(30));
INSERT INTO test1 VALUES ('qa_micky1');
INSERT INTO test1 VALUES ('qa_micky2');
[code].....

-- I should get the output as 4 not 8

View 5 Replies View Related

SQL & PL/SQL :: Exact Count Of Characters

Jan 7, 2013

How can I find out that exact count of '~'?

SELECT NVL(LENGTH('~~~~~~~~~~~~~~~~~')-LENGTH(REPLACE('~~~~~~~~~~~~~~~~~','~','')),0) result
FROM dual;

View 11 Replies View Related

How To See The Exact Special Character

Mar 18, 2013

I am using Release 10.2.0.1.0 version of oracle. I am getting a special character, but i suspect it as any other language character.

Its appearing in my 'TOAD editor/Sql prompt editor' as 'A?'. but when i am selecting it from the table using below query, its giving 'No rows Returned'.

select id from tab1 where id like 'A%';

How can i be able to see the exact character or which editor will enable me to see the character?

I think sql developer GUI might be able to show the same but i dont have sql developer with me.

View 1 Replies View Related

How To Know Exact Time Of Row Modified And Deleted

Jul 16, 2010

1)How can i know that in a table when i modified a row or deleted a row and which row i inserted when i want to know the particular time

can it is possiable if possiable then tell me how.

2)Is there any difference between 9i merge and 10g merge command ?

View 4 Replies View Related

SQL & PL/SQL :: Linking 2 Tables Without Exact Matches

Mar 4, 2011

I have two tables as per attachement - TABLE_A has Vehicle details while TABLE_B has Address details:

I am trying to build a query in order to link the Vehicle Details with their Address Details.

I would require an SQL that links records in TABLE_A with records in TABLE_B when group_number are the same; however links with group_number '999' (for the same customer_number) if there are no exact matches.

SELECT A.*,B.*
FROM TABKE_A A, TABLE_B B
WHERE ((A.CUSTOMER_NUMBER = B.CUSTOMER_NUMBER AND A.GROUP_NUMBER = B.GROUP_NUMBER)
OR (A.CUSTOMER_NUMBER = B.CUSTOMER_NUMBER AND A.GROUP_NUMBER = '999'))

The only problem with such query is that record in TABLE_A with group_number '456' will return 2 times. One with address having group_number '456' and one with group_number '999'.

View 8 Replies View Related

Server Administration :: Reorganize A Table And Index After The Deletion Of Records From Table?

Feb 7, 2012

We deleted millions of records from a table.

1.Is it necessary to reorganize a table and index after the deletion of records from table ? Because i see some change in table size after table and index reorganization.

2.Will re org table and index improve the database performance ?

View 7 Replies View Related

PL/SQL :: Selecting Records From 125 Million Record Table To Insert Into Smaller Table?

Jul 17, 2013

Oracle 11gI have a large table of 125 million records - t3_universe.  This table never gets updated or altered once loaded,  but holds data that we receive from a lead company. I need to select records from this large table that fit certain demographic criteria and insert those into a smaller table - T3_Leads -  that will be updated with regard to when the lead is mailed and for other relevant information.  select records from this 125 million record table to insert into the smaller table. 

I have tried a variety of things - views, materialized views, direct insert into smaller table...I think I am probably missing other approaches. My current attempt has been to create a View using the query that selects the records as shown below.  Then use a second query that inserts into T3_Leads from this View V_Market.  This is very slow. Can I just use an Insert Into T3_Leads with this query - it did not seem to work with the WITH clause?    My Index on the large table is t3_universe_composite and includes zip_code, address_key, household_key.   

CREATE VIEW V_Market  asWITH got_pairs    AS     (         SELECT /*+ INDEX_FFS(t3_universe t3_universe_composite) */  l.zip_code, l.zip_plus_4, l.p1_givenname, l.surname, l.address, l.city, l.state, l.household_key, l.hh_type as l_hh_type, l.address_key, l.narrowband_income, l.p1_ms, l.p1_gender, l.p1_exact_age, l.p1_personkey, e.hh_type as filler_data, 1.p1_seq_no, l.p2_seq_no       ,      ROW_NUMBER () OVER ( PARTITION BY  l.address_key                                    ORDER BY      l.hh_verification_date  DESC                    ) AS r_num         FROM   t3_universe  e         JOIN   t3_universe  l  ON                l.address_key  = e.address_key             AND l.zip_code = e.zip_code           AND   l.p1_gender != e.p1_gender      

[code]....

View 2 Replies View Related

How To Set Exact Page Size For Query Output Format

Oct 2, 2012

I have following shell script :-

In our testing DB local Server , we are using following script ... We are connecting Via putty ...

CODEexport ORACLE_SID=testdb
sqlplus /nolog <<eof
conn sys/sys as sysdba

[Code].....

QUOTE 1. How can i set pagesize to get good format Our problem is output format is not good .. we set set pagesize from 0 to 120 .. no improvement .. " Again Re-Installed VMware tools also ... no improvbement ....

2. We are planning to set alert message if "Archive destination crossed 60 % Script automatically will generate alert message via mobile or mail.. JUst we will configure crontab ....

View 6 Replies View Related

How To Know Data Is Coming From Exact Table from Union All View

Feb 28, 2013

I am using view AB_EV_VIEW created with UNION ALL of 10 tables (ex. AB_EV_1, AB_EV_2.... )

I want to know the data comming in select * from AB_EV_VIEW is from which table ?

Suppose AB_EV_1 is having column ID, NAME

sql> select * from AB_EV_VIEW

100, A1
200, A2
300, A3
400, A4
500, A5

View 3 Replies View Related

SQL & PL/SQL :: Insert All Records From External Table Into Export Table

Mar 25, 2013

following is the requirement

External Table
WKSHT_FILE_EXT
wksht_line
Export Table
Wksht_export
global_idvarchar2(10)
wksht_linevarchar2(250)
[code]....

Step 1.Insert all records from the external table into the export table. Truncate the export table first

Step 2.Read in a record from the export map table

Step 3.Search through export table records looking for the key words BRANCH =. Compare the branch code with the branch code form the map table

Step 4.If a match is found mark all records in the export table for the worksheet with the global ID from the export map table as follows..The first line of a worksheet is marked by the words WKSHTS..The last line of the work sheet is marked by the words COMPANY CONFIDENTIAL..We will need to capture the line break so also mark the next line after the COMPANY CONFIDENTIAL line

Step 5.Continue with Steps 2 - 4 until all records have been processed from the export map table.

first I have to create a procedure ti insert data from external table to export table.Global id will be blank.it will be updated by the mapping table's Global Id when The EB COLUMN's data(i.e 8p,2Betc ) will match with the BRANC=NA,2Betc of the datasheet loaded from the external table.. FOLLOWING IS THE SAMPLE DATASHEET

WKSHTS AAAAA BBBBBBBBBBB ELECTRONICS INC. TIME REPORT-DATE PAGE
SORT - BR, SLSREP AEC FIELD SALES REPRESENTATIVE 16:14 09/21/12 1
BRANCH = 2B
EMPLOYEE NAME SALVAAG, GREGG Days in the Month 28
[code]....

THERE ARE 2 pages..I have to split this LONG REPORT STORED IN WKSHT_LINE COLUMN OF EXPORT TABLE to 2 records..like wise 500 pages are there means 500 records.. AND THEN FIND BRANCH= after that which two words will come i.e NA,2B etc if it will MATCH WITH MAPPING TABLE"S EB COLUMN"S DATA,THEN MAPPING TABLE's GLOBAL ID WILL BE UPDATED TO EXPORT TABLE's GLOBAL ID WHICH IS BLANK

View 1 Replies View Related

JDeveloper, Java & XML :: Regular Expression For Exact Word And Occurrence

Mar 15, 2012

I need to search a specific pattern from a source code. In word, I need to check whether "getCode" has been called or not, for all the string inside double-quote("). Following are sample code lines -

1.->if(val==23){ month_desc = "a sample data"; }
2.->if(val==23){ month_desc = getCode("a sample data"); }
3.->if(val==23){ month_desc = "a " + getCode("sample data"); }
4.->if(val==23){ month_desc = getCode("sample data"); var2="sample data2";}

Now, expression should be such that it will return true during check for 1, 3 and 4, although, for 3 & 4 getCode has been called for part of the String.

View 2 Replies View Related

Forms :: Oracle 6i For Windows 7 64 Bit / Can't Find Exact Location From Google

Sep 20, 2012

i want to download form 6i and report 6i for window 7 64bit. from where i can download it. i can't find exact location from google.

View 6 Replies View Related

Backup & Recovery :: Exact Fetch Returns More Than Requested Number Of Row

Aug 24, 2011

I have perform a failover and encounters the following problem.

ORA-01422: exact fetch returns more than requested number of rows

initially primary db: chicago
physical standby db: boston

after failover

primary db:boston
physical standby: NA

after recreating physical standby

primary db:boston
physical standby: chicago

over at chicago (new standby)

log_archive_dest_3=E:chicago_arc
over at boston (new primary)
log_archive_dest_3=E:oston_arc

over at boston when I connect to both boston as target db and recovery catalog

RMAN> list archivelog like 'E:CHICAGO_ARC\%';

List of Archived Log Copies

Key Thrd Seq S Low Time Name
------- ---- ------- - --------- ----
252690 1 10 A 22-AUG-11 E:CHICAGO_ARC10_759842424_1.ARC

over at chicago when I connect to both chicago as target db and recovery catalog

RMAN> list archivelog like 'E:CHICAGO_ARC\%';

List of Archived Log Copies

Key Thrd Seq S Low Time Name
------- ---- ------- - --------- ----
252690 1 10 A 22-AUG-11 E:CHICAGO_ARC10_759842424_1.ARC

however at E:chicago_arc when I do a os check

C:Documents and SettingsAdministrator>dir /w E:chicago_arc

Volume in drive E is New Volume
Volume Serial Number is C874-DD6D

Directory of E:chicago_arc

[.] [..] 100_759410562_1.ARC
101_759410562_1.ARC 102_759410562_1.ARC 103_759410562_1.ARC

[Code]....

26 File(s) 9,077,989 bytes
2 Dir(s) 2,650,337,280 bytes free

there's more files than indicated by rman

also at both chicago and boston

I have the following error:

RMAN> debug on;

RMAN-03036: Debugging set to level=9, types=ALL

RMAN> report obsolete;

RMAN-06524: RMAN retention policy will be applied to the command
RMAN-06511: RMAN retention policy is set to redundancy 1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of report command at 08/24/2011 23:12:15
RMAN-06004: ORACLE error from recovery catalog database: ORA-01422: exact fetch returns more than requested number of rows

RMAN> debug off;

Debugging turned off

here's the trace files I logged

DBGRCVMAN: EXITING listBackup with exception: ORA-01422: exact fetch returns more than requested number of rows
DBGMISC: krmicomp: error 6004 signalled during compilation [23:12:15.358]
DBGMISC: ENTERED krmkmrsr [23:12:15.358]

[Code]...

How should I resolve this issue?

View 5 Replies View Related

Reports & Discoverer :: Continuous Pages Not Printing In Exact Pre-printed Area

Nov 29, 2011

I have a Invoice Report, i will give the parameters.

From_Inv_No:
To_Inv_No:
From_Inv_Date:
To_Inv_Date:

so i will give 10 invoices with dates in the above parameters to generate the report, actually the report prints in a pre-printed sheet, well it prints the first page correctly but the second page and continuous pages not printing in the exact pre-printed area. example see below;

(Page2)
506176
28/11/2011
(Preprinted text)INVOICE NO :
INVOICE DATE:

how to give spaces between pages actually every pages it should print 3 to 4 inches gap between the first page but it prints just one inch above the preprinted area. how to make it print without gaps. Additional Information: Preprinted sheet Height 17 inches.

Paper Layout Width 8.5
Height 12

Character Mode

Report Width 80
Report Height 72

for header section, main and trailer sections above readings only given.

View 3 Replies View Related

Forms :: ORA-01422 / Exact Fetch Returns More Than Requested Number Of Rows

Aug 18, 2010

ORA-01422: exact fetch returns more than requested number of rows.

I receive this error because i tried to introduce the below coding in a post query of the block.

begin
select supplier_cd into :fin_ex_rev_head.vendor_code
from fin_ex_rev_receipts
where receipt_date
between :keyblock.receipt_date

[code].....

View 10 Replies View Related

Export/Import/SQL Loader :: Get Exact Path Where SQLLDR Got Installed In UNIX?

Nov 1, 2013

How to get the exact path where SQLLDR got installed in UNIX. I am getting a path related issue while executing SQLDR unix command in Oracle

View 3 Replies View Related

Insert Newest Records From One Table Into Another Table

Mar 9, 2004

Trying to auto insert the newest records from one table into another Table. I have a vendor provided table that is part of my database (running Oracle 9i) so I can't change the underlying structure to it or their process stops fluxing. However, I can add a trigger to it. What I want to do is this:

When the vendor's software inserts a new row (through their own automated process) I want to insert data from that same new record into another table of my own. (where of course I can re-format it, etc., and make the data my own)

The original vendor table does not have a insertion timestamp field to work off of.What is the best way to trigger an insert off the latest inserted record? It works to replace all the records in the entire vendor table but I only want to insert one record at a time.

View 2 Replies View Related

SQL & PL/SQL :: External Table Query (compare Number Records In File With External Table)

Jan 23, 2013

I have got a procedure that successfully creates an oracle external table and populates it with the contents of a file. This works fine until I have a situation where one of the fields is a VARCHAR2(2) and I try to insert say, a 5 character value. When this happens the record in question does not get populated in the external table (and rightly so), but I could do with working out if there is a discrepancy in the number of records in the file and the number of records that actually make it into the table so I could inform the user that there is a problem.

I have attached the code that creates the external table and populates it.

View 5 Replies View Related

SQL & PL/SQL :: Send Records From One Table To Another

Apr 21, 2011

I have requirement like we need to send records from one table to another table. for example if i have 4 records in Table A , first i need to send only 2 records to Table B then again rest 2 records to the Table B.

View 10 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved