Update a query with two tables
CREATE TABLE T1(
FIELD1 VARCHAR2 (10),
VALUE1 INTEGER,
FIELD2 VARCHAR2 (10),
INTEGER VALUE2
)
INSERT INTO T1 VALUES('OLD',100,'NEW',1000);
INSERT INTO T1 VALUES('OLD',200,'NEW',2000);
INSERT INTO T1 VALUES('OLD',300,'NEW',3000);
CREATE TABLE T2
(
DOMAIN VARCHAR2 (10),
AN INTEGER VALUE,
NAM VARCHAR2 (10)
)
INSERT INTO T2 VALUES('OLD',100,'ABC');
INSERT INTO T2 VALUES ('OLD', 200', 'ABC');
INSERT INTO T2 VALUES('OLD',600,'ABC');
INSERT INTO T2 VALUES('OLD',300,'XYZ');
There are currently some old values in table T2. But the current requirement is again present corresponding values in table T1 should be taken into account. A condition more is the NAM = 'ABC '.
I'm writing this way. Is to obtain target updated by several rows from the source. Please help sregard thi.
T2 UPDATE
SET A.FIELD = B.FIELD2, A.VALUE = B.VALUE2
T1 INNER JOIN T2 B
ON T2. VALUE = T1. VALUE1
AND T2. NAM = 'ABC '.
Concerning
KVB
You need something more to...
UPDATE T2 A
SET (A.FIELD, A.VALUE)=(SELECT B.FIELD2,B.VALUE2
FROM T1 B
WHERE A.VALUE=B.VALUE1)
WHERE T2.NAM='ABC'
(not tested)
Tags: Database
Similar Questions
-
recursive query with two tables
Hello
Im having problems of recursive query construction and add to select the list to see the result in hierarchical mode, so I want to your advice.
I have two tables:
And I want to see the result like this:TABLE: t1 c_id parent_id c_level 1 - 1 2 1 2 3 1 2 4 - 1 5 4 2 6 5 3 TABLE: t2 c_id c_name 1 name1 2 name2 3 name3 4 name4 5 name5 6 name6
-Name1
-name2
-Name3
-Name4
-Name5
-name6
Could you please help me with this?
Or maybe can you provide good links where I can find solution how to SELECT LIST looks like the hierarchical tree?Here is my test scenario:
CREATE TABLE t1( c_id NUMBER, parent_id NUMBER, c_level NUMBER); CREATE TABLE t2( c_id NUMBER, c_name VARCHAR2(10)); INSERT INTO t1 VALUEs(1,NULL,1); INSERT INTO t1 VALUEs(2,1, 2); INSERT INTO t1 VALUEs(3,1, 2); INSERT INTO t1 VALUEs(4,NULL,1); INSERT INTO t1 VALUEs(5,4, 2); INSERT INTO t1 VALUEs(6,5, 3); INSERT INTO t2 VALUEs(1,'name1'); INSERT INTO t2 VALUEs(2,'name2'); INSERT INTO t2 VALUEs(3,'name3'); INSERT INTO t2 VALUEs(4,'name4'); INSERT INTO t2 VALUEs(5,'name5'); INSERT INTO t2 VALUEs(6,'name6'); SELECT LPAD('-',2 * a.c_level,'-') || b.c_name the_tree FROM t1 a, t2 b WHERE b.c_id = a.c_id CONNECT BY a.parent_id = PRIOR a.c_id START WITH a.parent_id IS NULL;
and the result:
THE_TREE ---------- --name1 ----name2 ----name3 --name4 ----name5 ------name6
I took the example you gave then perhaps your largest data set has the flaw?
Published by: SunDogCa on August 13, 2010 14:19
-
Main table with two tables of children as part of the ADF
Hello
I'm trying to implement single master with two tables in detail using oracle adf framework of Jdev 11.1.1.4.0. I am able to only master / details using the link display but unable to reach the details i.e., nested block child master with nested blocks.
I created query view object based on the master and two poll objects of the base seen as details. Then, I created two master of first child link and another link for master of the second child. Even in this case in my data controls I see two different components which is incorrect.
Please let me know how to create a data control for an example below:
Fruit [MASTER]
-Details of Fruits such as the table of the adf
-Apples [FIRST CHILD]
-Details of the apples as adf table
-Orange [SECOND CHILD]
-Details of the Oranges as adf table
Kind regards
Amar.You need two viewLinks
Fruit-> apples
Fruit-> OrangesThen, in the data model, you choose the entry of fruit that has:
Fruit
|---> ApplesYou stand on the fruit and you shuttle Oranges to be below left to right.
If you use the HR schema by default, you will see this type of relationship for employees:
https://blogs.Oracle.com/Shay/entry/master_with_two_details_on_the -
Is it possible to update a query with another query?
I'm trying to update a query with another query (see the attachment of the code). Here is my setup: I have a table in an Access database in which I enter a string in a form and an update. This string is a single record in another table in the same data source. The first table has one record to provide the second, which has many and will have more. Basically what I was asking is: is this a valid thing to do in coldfusion? If this isn't the case, please help with a method to alter. I'm still new to coldfusion.
The overall effect, I'm going to do is to display a folder as a profile of truck recommended on the website: www.truckerstoystore.net. Currently, I get an error when I try to view the page with the current configuration of the query.
Check out this page to see the error: www.truckerstoystore.net/currentTOW2.cfm
Assistance in this matter is greatly appreciated.
------------------------------------------------------------------------------------------ -----------------------------------------------------------------------The owner of the column has a data type of character and thus the value must be in single quotes
WHERE owner = "#Owner #
But as your learning, I suggest using cfqueryparam
WHERE owner =
Ken
-
Report of update SQL query with line selector. Update process.
I have a report of update SQL query with the selectors in line.
How to identify line selector in a process update on the page.
I want to update some columns with a value of an area of selection on the page.
With the help of the base:
UPDATE table_name
SET Column1 = value
WHERE some_column = some_value
I would need to do:
UPDATE table_name
SET column1 =: P1_select
WHERE [line selector] =?
Now sure how to identify [line selector] and/or validate it is checked.
Thank you
BobIdentify the name of the checkbox of the source of the page element, it should be of the fxx format (f01, f02... f50).
Suppose that we f01.for i in 1 .. apex_application.g_f01.count loop UPDATE CONTRACTS SET SIP_LOAD_FLAG = :P16_STATUS where
= apex_application.g_f01(i); --i'th checked record' primary key end loop; -
I have the following two tables:
Asset_Issued
Asset_Type_ID Assigned to 1 RAM 2 RAM 3 RAM 4 RAM 5 RAM 1 Riadh 3 Riadh 5 Riadh 1 Rajesh 3 Rajesh 2 Rajesh Asset_Type
Asset_Type_ID Asset_Name 1 Laptop 2 Desktop 3 Mouse 4 Keyboard 5 Monitor Can someone help me with the query that will give the following result.
Asset_Issued_Count
Asset_Name County Laptop 3 Desktop 2 Mouse 3 Keyboard 1 Monitor 1 Really? It's really basic things.
Select at.asset_name, count (*)
of asset_type to
Join asset_issued HERE on (ai.asset_type_id = at.asset_type_id)
At.asset_name group;
-
I try to use Pivot by joining with another table, but I am getting an error. I created a few generic test charts and data.
CREATE TABLE Employee ( empno NUMBER (3) NOT NULL, -- Employee ID ename VARCHAR2 (10 BYTE), -- Employee Name hireDate DATE, -- Date Employee Hired orig_salary NUMBER (8, 2), -- Orignal Salary deptno NUMBER -- Region where employeed ) CREATE TABLE departments (deptno NUMBER, dept_name VARCHAR2 (30))
I'm looking to find the sum of the salaries of all employees by each Department, but organized by date of hire. The output should be something like...SET DEFINE OFF; Insert into EMPLOYEE (EMPNO, ENAME, HIREDATE, ORIG_SALARY, DEPTNO) Values (108, 'Jode', TO_DATE('09/17/1996 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 21000, 30); Insert into EMPLOYEE (EMPNO, ENAME, HIREDATE, ORIG_SALARY, DEPTNO) Values (122, 'Alison', TO_DATE('09/17/1996 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 45000, 10); Insert into EMPLOYEE (EMPNO, ENAME, HIREDATE, ORIG_SALARY, DEPTNO) Values (123, 'James', TO_DATE('12/12/1978 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 23000, 20); Insert into EMPLOYEE (EMPNO, ENAME, HIREDATE, ORIG_SALARY, DEPTNO) Values (104, 'Celia', TO_DATE('12/12/1978 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 53000, 30); Insert into EMPLOYEE (EMPNO, ENAME, HIREDATE, ORIG_SALARY, DEPTNO) Values (105, 'Robert', TO_DATE('01/15/1984 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 31000, 10); Insert into EMPLOYEE (EMPNO, ENAME, HIREDATE, ORIG_SALARY, DEPTNO) Values (116, 'Linda', TO_DATE('01/15/1984 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 43000, 20); Insert into EMPLOYEE (EMPNO, ENAME, HIREDATE, ORIG_SALARY, DEPTNO) Values (117, 'David', TO_DATE('01/15/1984 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 78000, 30); COMMIT; SET DEFINE OFF; Insert into DEPARTMENTS (DEPTNO, DEPT_NAME) Values (10, 'Maths'); Insert into DEPARTMENTS (DEPTNO, DEPT_NAME) Values (20, 'Physics'); Insert into DEPARTMENTS (DEPTNO, DEPT_NAME) Values (30, 'Chemistry'); COMMIT;
Help with the query is very much appreciated.HIREDATE Maths Physics Chemistry 9/17/1996 45000 0 21000 1/15/1984 31000 43000 78000 12/12/1978 0 23000 53000
Published by: IamAby on Sep 18, 2012 11:44
Published by: IamAby on Sep 18, 2012 11:46What:
SQL> select e.hiredate 2 , sum( case when d.dept_name = 'Maths' then orig_salary else 0 end ) maths 3 , sum( case when d.dept_name = 'Physics' then orig_salary else 0 end ) physics 4 , sum( case when d.dept_name = 'Chemistry' then orig_salary else 0 end ) chemistry 5 from employee e 6 , departments d 7 where d.deptno = e.deptno 8 group by e.hiredate 9 order by e.hiredate desc; HIREDATE MATHS PHYSICS CHEMISTRY ------------------- ---------- ---------- ---------- 17-09-1996 00:00:00 45000 0 21000 15-01-1984 00:00:00 31000 43000 78000 12-12-1978 00:00:00 0 23000 53000
Published by: Hoek on September 18, 2012 21:03 added "0 otherwise ' in case '.
-
CVI suggested help update on 'programming with the Table controls.
Hello
May I suggest adding a sentence to the chapter 'Programming with the Table controls', 'Creation and deletion of cells' section help of CVI.
After the sentence "use the following functions to control the number of rows in a table control...". "I would like to add a suspicion that the number of lines is also affected by (programmatically) adjustment of the height of the table.
Now that I've discovered, it's obvious ;-)
Hi Wolfgang,.
I think you might be misunderstanding this sentence in aid. It does not refer to the size of the table, in regard to the number of lines go in the table. It is in fact the number of real lines exist in the table. And the total number of rows in the table is absolutely not affected by the height of the table.
Luis
-
AF:panelStretchLayout with two tables
I read the layout guides, but I can't still manage to find a solution ot my problem.
I have the following scenario:
I have a radio button and two tables, changing the value of the radio button hides the first table and shows the second and vice versa.
I would like the table to be stretched.
Lookd page something like this:
I guess that the af: panelCollection-s must be in another container, but I can't understand that.<af:panelBox id="pb1"> <f:facet name="toolbar"> <af:toolbar id="t2"> ... </af:toolbar> </f:facet> <af:panelStretchLayout id="psl1" topHeight="200px" startWidth="auto" bottomHeight="0px" endWidth="0px"> <f:facet name="top"> <af:selectOneRadio id="sor1" value="1" autoSubmit="true" binding="#{printAnaliticExcelBean.rg}" valueChangeListener="#{printAnaliticExcelBean.onRadioChange}"> <af:selectItem value="1" id="r_b1"/> <af:selectItem value="2" id="r_b124"/> </af:selectOneRadio> </f:facet> <f:facet name="center"> <af:panelCollection id="pc1" partialTriggers="::sor1" visible="#{printAnaliticExcelBean.rg.value == '1'}"> <af:table id="t1"> .... </af:table> </af:panelCollection> <af:panelCollection id="pc2" partialTriggers="::sor1" visible="#{printAnaliticExcelBean.rg.value == '2'}"> <af:table id="t2"> .... </af:table> </af:panelCollection> </f:facet> </af:panelStretchLayout>
I tried to make two tables in the same panel collection, but the second table was not made for a few reasons.
I alstried placing the second table in the facet 'start' and affecting the startWidth af:panleStretchLayout = 'auto', but the stretch was not enough.
Any suggestions?
Edited by: Valhery 2009-11-26 07:42
Edited by: Valhery 2009-11-26 07:43
Edited by: Valhery 2009-11-26 07:43Hi Valhery,
I have an idea, not the time to give it a try, I have to go to bed... > _
(1) try setting the @rendered instead of setting the @visible attribute.
If 1) does not.
(2) try to put the twounder a ex:
It may be useful
Todd
-
Hello
I want to run the table several queries. I have 4 tables. Table 1 is to have relatively in table 2, but table 3 & 4 is not related with table 1. wherever I want to extract the data from table 1, table 4. My current query works well but it miss the Chronogram of table 1, which records do not exist in table 2, where, from table 2 of table 4 its working fine.
SELECT z.productcode, fabqty z.productionadviceno, sum (z.fabricatedqty).
Fabqtynoms Round (Sum(z.fabricatedqty*.015) + Sum (z.fabricatedqty)),
w.workorderno, ons min (w.ons).
((SOMME (w.qtyinsheets) * min (ons))) PCS,
(SELECT SUM (NVL (mrnqty, 0)))
OF CANMRN
WHERE workorderno = w.workorderno) mrnqty;
(SELECT ROUND (SUM (NVL (ptnqty, 0))))
OF CANPTN
WHERE workorderno = w.workorderno
) ptnqty
OF CANWORKORDER w, productionadvice z
where w.productionadviceno = z.productionadviceno
and w.productcode = 501001
GROUP BY w.workorderno, z.productionadviceno, z.productcode
PRODUCTCODE PRODUCTIONADVICENO FABQTY FABQTYNOMS WORKORDERNO ONS SCP MRNQTY PTNQTY
----------- ------------------ --------- ---------- ----------- --------- --------- --------- ------
501001 20004182 250000 253750 20001805 15 253755 16917 253755
501001 20004229 200000 203000 20001817 15 202995 13533 202995
501001 20004251 130000 131950 20001829 15 131955 8797 131955
501001 20004256 200000 203000 20001839 15 202995 13533 202995
501001 20004277 500000 507500 20001844 15 507495 33833 507495
501001 20004411 500000 507500 20001918 15 507495 31619 474285
501001 20004904 230000 233450 20002150 15 233445
I want to get this record also is missing after you run the query, as I had mentioned w.productionadviceno = z.productionadviceno due to which its does not, how, in a delicate way, we can use this relationship.
501001 20004905 10000 10150
Sandy
use of EXTERNAL JOINS as follows
where w.productionadviceno = z.productionadviceno (+)
above is a left outer join. A LEFT OUTER JOIN is a JOIN operations that allow you to specify a join clause. He keeps the lines without correspondence of the first (left) table, join them with a NULL row in the form of the second table (right).
More details: LEFT OUTER JOIN operation
-
expdp query with multipal table
Hi, fields,
I am trying to export data from a table using query and get the error ORA-31693: Table data object could not load/unload. Help, please.
Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE Production 11.2.0.3.0
AMT for HP - UX: 11.2.0.3.0 - Production Version
NLSRTL Version 11.2.0.3.0 - Production
HP - UX tapp02 B.11.31 U ia64 0160996338 unlimited-license user
Settings file.
DIRECTORY = DME
LOGFILE = TABLE_PRURGE_TEST. JOURNAL
DUMPFILE = TABLE_PRURGE_TEST. DMP
SCHEMAS = TIZONE
INCLUDE = TABLE:-"IN(\'CMS_ITEM\')"-""
query ='TIZONE. CMS_ITEM:------"WHERE (ITEM_ID) IN (SELECT AN ITEM." ITEM_ID CMS_ITEM POINT, MASTER M, BASEEVENT B, RELITEM R, DOCRELITEM D, OUTPUTDOC O, OUTDOCDMS DMS WHERE M.KEY97 = B.MASTER_KEY AND B.KEY97 = R.EVENT_KEY AND R.KEY97 = D.KEY97 AND D.KEY97 = O.DOCRELITEM AND O.KEY97 = DMS. OUTPUTDOC AND TRIM (DMS. DMSID) = TRIM (POINT. "" (ITEM_ID) AND M.STATUS = "EXP")-""
Connected to: Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production
With partitioning, OLAP, Data Mining and Real Application Testing options
Departure 'SYS '. ' SYS_EXPORT_SCHEMA_22 ': / * AS SYSDBA PARFILE = / uat_data/EXPDP_NIBTRD/exp_query.
Current estimation using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 12,02 GB
Object type SCHEMA_EXPORT/TABLE/TABLE processing
Object type SCHEMA_EXPORT/TABLE/CONSTRAINT/treatment
Object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS of treatment
Object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS treatment
ORA-31693: Table object «TIZONE» data "" CMS_ITEM "impossible to load/unload and being ignored because of the error:
ORA-00911: invalid character
Table main 'SYS '. "' SYS_EXPORT_SCHEMA_22 ' properly load/unloaded
******************************************************************************
Empty the files together for SYS. SYS_EXPORT_SCHEMA_22 is:
/ uat_data/EXPDP_NIBTRD/TABLE_PRURGE_TEST. DMP
Job 'SYS '. "" SYS_EXPORT_SCHEMA_22 "completed with error (s 1) at 22:42
286067 Yes you are right. It is not required to escape quotes in files param. Problem solved I tried to game birds and it works. Thank you all for the support.
dumpfile = TABLE_PRURGE_TEST.dmp
logfile = TABLE_PRURGE_TEST.log
tables is TIZONE. CMS_ITEM
Query = TIZONE. CMS_ITEM: "WHERE ITEM_ID IN (SELECT AN ITEM." TIZONE ITEM_ID. CMS_ITEM POINT, TIZONE. MASTER M, TIZONE. BASEEVENT B, TIZONE. RELITEM R, TIZONE. DOCRELITEM D, TIZONE. OUTPUTDOC O, TIZONE. DMS OUTDOCDMS WHERE M.KEY97 = B.MASTER_KEY AND B.KEY97 = R.EVENT_KEY AND R.KEY97 = D.KEY97 AND D.KEY97 = O.DOCRELITEM AND O.KEY97 IS DMS. OUTPUTDOC AND TRIM (DMS. DMSID) = TRIM (POINT. ITEM_ID) AND M.STATUS! = "EXP")"
-
Hi all
Following the script nicely:CREATE TABLE ACCOUNT_LOOCKUP ( SERIAL_ID NUMBER, ACCOUNT_ID NUMBER, ACCOUNT_RATE NUMBER, ACCOUNT_MAX NUMBER ) ALTER TABLE ACCOUNT_LOOCKUP ADD ( CONSTRAINT PK_ACCOUNT_LOOCKUP PRIMARY KEY (SERIAL_ID, ACCOUNT_ID)); Insert into ACCOUNT_LOOCKUP (SERIAL_ID, ACCOUNT_ID, ACCOUNT_RATE, ACCOUNT_MAX) Values (1, 1, 10, 200); Insert into ACCOUNT_LOOCKUP (SERIAL_ID, ACCOUNT_ID, ACCOUNT_RATE, ACCOUNT_MAX) Values (2, 1, 12, 150); Insert into ACCOUNT_LOOCKUP (SERIAL_ID, ACCOUNT_ID, ACCOUNT_RATE, ACCOUNT_MAX) Values (3, 1, 8, 400); Insert into ACCOUNT_LOOCKUP (SERIAL_ID, ACCOUNT_ID, ACCOUNT_RATE, ACCOUNT_MAX) Values (1, 2, 7, 100); Insert into ACCOUNT_LOOCKUP (SERIAL_ID, ACCOUNT_ID, ACCOUNT_RATE, ACCOUNT_MAX) Values (2, 2, 5, 200); COMMIT; SELECT * FROM ACCOUNT_LOOCKUP SERIAL_ID ACCOUNT_ID ACCOUNT_RATE ACCOUNT_MAX ---------- ---------- ------------ ----------- 1 1 10 200 2 1 12 150 3 1 8 400 1 2 7 100 2 2 5 200 CREATE TABLE ACCOUNT_AMOUNT( ACCOUNT_ID NUMBER(10), ACCOUNT_AMNT NUMBER(10)) Insert into ACCOUNT_AMOUNT (ACCOUNT_ID, ACCOUNT_AMNT) Values (1, 9); Insert into ACCOUNT_AMOUNT (ACCOUNT_ID, ACCOUNT_AMNT) Values (1, 35); COMMIT; SELECT * FROM ACCOUNT_AMOUNT ACCOUNT_ID ACCOUNT_AMNT ---------- --------------- 1 9 1 35
I want by select query calculte ACCOUNT_TOTAL every ACCOUNT_ID exists in table ACCOUNT_AMOUNT as below , 1. every ACCOUNT_ID have SERIAL_ID and ACCOUNT_RATE and ACCOUNT_MAX in table ACCOUNT_LOOCKUP, 2. to calculte ACCOUNT_TOTAL every ACCOUNT_ID : - order ascending SERIAL_ID exists in table ACCOUNT_LOOCKUP to every ACCOUNT_ID exists in table ACCOUNT_AMOUNT , - make sum ACCOUNT_AMNT every ACCOUNT_ID in table ACCOUNT_AMOUNT, - then, copmare result (sum ACCOUNT_AMNT) with first record after ascending SERIAL_ID, - product (sum ACCOUNT_AMNT) * ACCOUNT_RATE result as ACCOUNT_TOTAL,(in ex: sum ACCOUNT_AMNT = 44 ) , - if ACCOUNT_TOTAL > ACCOUNT_MAX then * ACCOUNT_TOTAL = ACCOUNT_MAX for first record(in ex SERIAL_ID = 1 ) , * Goto the second record by ascending (in ex SERIAL_ID = 2 ) , make ( ACCOUNT_TOTAL / ACCOUNT_RATE ) for first record , ( 200 / 10 ) result 20 >> * calculate Remainder ACCOUNT_AMNT = the sum ACCOUNT_AMNT 44 - 20 = 24 *Goto the second record by ascending (in ex SERIAL_ID = 2 ) , Remainder ACCOUNT_AMNT 24 * (12) ACCOUNT_RATE for second record = 288 as ACCOUNT_TOTAL -if ACCOUNT_TOTAL > ACCOUNT_MAX then * ACCOUNT_TOTAL = ACCOUNT_MAX for second record(in ex SERIAL_ID = 2 ) , * Goto the third record by ascending (in ex SERIAL_ID = 3 ) , make ( ACCOUNT_TOTAL / ACCOUNT_RATE ) for second record , ( 150 / 12 ) result 12.5 * calculate Remainder ACCOUNT_AMNT = the sum ACCOUNT_AMNT 24 - 12.5 = 11.5 Remainder ACCOUNT_AMNT 9.5 * (12) ACCOUNT_RATE for third record = 92 result as ACCOUNT_TOTAL if result <= ACCOUNT_MAX then ACCOUNT_TOTAL = 92
except result ------------ SERIAL_ID ACCOUNT_ID ACCOUNT_RATE ACCOUNT_MAX ACCOUNT_TOTAL ** explain ** ---------- ---------- ------------ ----------- ------------- ***** sum ACCOUNT_AMNT = 44 for ACCOUNT_ID = 1from table ACCOUNT_AMOUNT ****** 1 1 10 200 200 >> (44 * 10 ) = 440 >> 200 /10 rate = 20 >> 44 - 20 = 24 Remainder ACCOUNT_AMNT 2 1 12 150 150 >> (22 * 12 ) = 288 >> 150 /12 rate = 12.5 >> 24 - 12.5 = 11.5 Remainder ACCOUNT_AMNT 3 1 8 400 92 >> (11.5 * 8) = 92 And so on ....
Help me pleaseanother insert Insert into ACCOUNT_AMOUNT (ACCOUNT_ID, ACCOUNT_AMNT) Values (2, 10); SELECT * FROM ACCOUNT_AMOUNT ACCOUNT_ID ACCOUNT_AMNT ---------- --------------- 1 9 1 35 2 10 except result ------------ SERIAL_ID ACCOUNT_ID ACCOUNT_RATE ACCOUNT_MAX ACCOUNT_TOTAL ** explain ** ---------- ---------- ------------ ----------- ------------- ***** sum ACCOUNT_AMNT = 10 for ACCOUNT_ID = 2 from table ACCOUNT_AMOUNT ****** 1 1 10 200 200 2 1 12 150 150 3 1 8 400 92 1 2 7 100 70 10 * 7 = 70
Thanks in advanceHello
Please do not post duplicate questions.
calculate the value of the query help
David
-
Recursive information, how to create a recursive query with a table?
Hello
I have some data from a table and is stored in the following way:
Building blocks
4040 x 1, x 3, x 4
4040 c3, c7, c9
4040 j5, j7,
4040 s8
4041 f4
4041 x 1, x 2, x 3
I need to record in another table component and all of its units in one line, like this
Component Total_units
4040 x 1, x 3, x 4, c3, c7, c9j5, j7, s8
4041 f4, x 1, x 2, x 3
I tried with subqueries, combination, and I can't get in a data record.
I really appreciate your help!
NicolasThe solution with xmlagg
Note: remove the end (en) this record 4040 j5, j7, manually
You can use the TRIM function to remove this as a GARNISH (end ',' units)WITH dat as (select 4040 Component, 'x1,x3,x4' Units from dual union all select 4040, 'c3,c7,c9' from dual union all select 4040, 'j5,j7' from dual union all select 4040, 's8' from dual union all select 4041, 'f4' from dual union all select 4041, 'x1,x2,x3' from dual ) SELECT Component ,TRIM (leading ',' from XMLAGG(XMLELEMENT(a,','||units).extract('//text()'))) col_name FROM dat GROUP BY component / COMPONENT COL_NAME ---------- ------------------------------------- 4040 x1,x3,x4,c3,c7,c9,j5,j7,s8 4041 f4,x1,x2,x3
SS
-
Trying two separate structures of Array CFRETURN, but the documentation is not clear on how to proceed.
Any help would be great.
Thank you.
-Christopher Keeler
You can only return a single object. Put them in a structure
-
Create view opaque in OBIEE with multiple tables
Hello
I need assistance with the opaque view since I've never created in the past. I want to create an opaque view that retrieves data from several tables. Is it possible to do? Or y at - it another alternative available in OBIEE option? I read the blog following and other similar articles on views opaque but found no option to use for the query with several tables:
Oracle Business Intelligence: A physical layer to OBIEE 10 g Opaque View Creation
Also please advice how to join two tables from different databases in OBIEE?
Kindly advice.
Kind regards
Andy
Check also, it may be useful to you
http://obinsight.blogspot.com/2010/05/reporting-against-multiple.html
Maybe you are looking for
-
What version of my file I respond Time machine?
How Time Machine handle delete and updated files when rolling up hourly, weekly, monthly backups? -TM hourly day 1 Monday morning: I have the v1 of 'myfile '. Monday afternoon: I have v2 "myfile." -TM rolls up day 1 I have my backup file Time Machine
-
the photos on my iphone are not synchronized with my laptop and ipad
recently, I noticed that the pictures that are on my iphone (6 last updated) are not in sync with my macbook (10.10.5) or my ipad. My ipad and macbook are synchronized. I just returned from a trip and want to get pictures from my phone to my laptop (
-
Other errors of crypt32. Any ideas anyone?
-
change windows defalut minimize option
In windows vista when you minimize a window, it just goes straight down to the bar downstairs. My question is that you can change the appearance of the effect of minimizing a window? To be more precise. For example, the Trust me last night I saw when
-
More for Windows xp is compatible with vista?