Several lines of subquery
Newbie needs help.My SQL statement returns multiple lines, but even after reading the manual I can't understand yet how to use the IN, ALL or PART of the operators to make several lines.
Version:
BANNER
Oracle Database 10 g Express Edition Release 10.2.0.1.0 - product
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
AMT for 32-bit Windows: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
Update proj_assigned
Set project_cost = (select job_charge_per_hour * proj_assigned hours_allocated);
RESULT: einreihig subquery returns multiple rows
Edited by: 996465 03/28/2013 10:47
Update proj_assigned
Set project_cost = (select job_charge_per_hour * proj_assigned hours_allocated);
In the above sub query you select all lines. Use where clause so that it chooses the only record in the subquery.
Or
You can modify the query, if you want to update project_cost in the Proj_assigned table as below
Update proj_assigned set project_cost = job_charge_per_hour * hours_allocated;
Tags: Database
Similar Questions
-
Help: several lines subquery
Hello
My question hinges off the coast of the same type of DB as the question here a little backward (https://forums.oracle.com/thread/1982906).
The question is: determine who or the authors wrote the books most often purchased by customers of JustLee books
I'm currently building a subquery of several lines (I don't know if that would be the best way to approach). I have provided the table at the bottom of this post.
By my code below, as you can see, this does not work for me. I'm going to pull the total number of each book (via isbn inside the authoridtable), then I'll look up the code of the author and, in the end, the name of the author (table orderitems then bookauthor). I work from the inside to the outside and can't get through using the first subquery.
Could someone please be able to help point me in the right direction?
Thanks for your help!
SQL > SELECT isbn, authorid2 FROM bookauthor
3. WHERE IN (SELECT COUNT (isbn) isbn
4 FROM orderitems
5 GROUP BY isbn)
6 ORDER BY isbn, authorid;
no selected line
TABLES:
SQL > select * from orderitems.
ORDER ITEM # QUANTITY PAIDEACH ISBN NO.
---------- ---------- ---------- ---------- ----------
1000 1 3437212490 1 19.95
1001 1 9247381001 1 31.95
1001 2 2491748320 1 85,45
1002 1 8843172113 2 55.95
1003 1 8843172113 1 55.95
1003 2 1059831198 1 30.95
1003 3 3437212490 1 19.95
1004 1 2491748320 2 85,45
1005 1 2147428890 1 39.95
1006 1 9959789321 1 54.5
1007 1 3957136468 3 72.15
1007 2 9959789321 1 54.5
1007 3 8117949391 1 8.95
1007 4 8843172113 1 55.95
1008 1 3437212490 2 19.95
1009 1 3437212490 1 19.95
1009 2 0401140733 1 22
1010 1 8843172113 1 55.95
1011 1 2491748320 1 85,45
1012 1 8117949391 1 8.95
1012 2 1915762492 2 25
1012 3 2491748320 1 85,45
1012 4 0401140733 1 22
1013 1 8843172113 1 55.95
1014 1 0401140733 2 22
1015 1 3437212490 1 19.95
1016 1 2491748320 1 85,45
1017 1 8117949391 2 8.95
1018 1 3437212490 1 19.95
1018 2 8843172113 1 55.95
1019 1 0401140733 1 22
1020 1 3437212490 1 19.95
SQL > select * from bookauthor;
ISBN AUTH
---------- ----
0132149871 S100
0299282519 S100
0401140733 J100
1059831198 P100
1059831198 S100
1915762492 W100
1915762492 W105
2147428890 W105
2491748320 B100
2491748320 F100
2491748320 R100
3437212490 B100
3957136468 A100
4981341710 K100
8117949391 R100
8843172113 A100
A105 8843172113
8843172113 P105
9247381001 W100
9959789321 J100
20 selected lines.
SQL > select * from the author.
FNAME LNAME AUTH
---- ---------- ----------
S100 SAM SMITH
J100 JANICE JONES
A100 AUSTIN JAMES
M100 SHEILA MARTINEZ
K100 KZOCHSKY TAMARA
P100 PORTER LISA
A105 ADAMS JUAN
B100 JACK BAKER
P105 PETERSON TINA
W100 WILLIAM WHITE
W105 LISA WHITE
R100 ROBINSON ROBERT
F100 FIELDS OSCAR
W110 WILKINSON ANTHONY
14 selected lines.
Hello
Thanks for posting the sample data.
Be sure to post the results desired from this data, the reason why you want to these results and your version of Oracle.
You can reach the author table in the main query I posted earlier.
WITH got_total AS
(
SELECT isbn
The AMOUNT (quantity) AS total - may be
, EVALUATE () OVER (ORDER OF SUM (amount) DESC) AS rnk
Of orderitems
GROUP BY isbn
)
SELECT b.isbn
a.authorid
a.lname
a.fname
t.total
OF bookauthor b
JOIN got_total t WE b.isbn = t.isbn
JOIN the author an a.authorid ON = b.authorid
WHERE t.rnk = 1
;
I see that orderitems has a quantity column. SUM (quantity), not to COUNT (*), is probably what you want to determine the author of bestsellers.
The above query gives these results:
TOTAL FNAME LNAME ISBN AUTH
---------- ---- ---------- ---------- ----------
3437212490 B100 BAKER JACK 8
-
01427 00000 - "einreihig subquery returns several lines.
Hi all
How can I solve it
This code gives me this errorSELECT v.code ,v.bar_code ,v.arb_name ,v.eng_name ,v.branch_no ,(SELECT sum(quantity) FROM viw_whs_items_movement GROUP BY branch_no) FROM viw_whs_items_movement V
01427 00000 - "einreihig subquery returns several lines.
I know that I have more value, but I need this value
Result group
SELECT sum(v.quantity) FROM viw_whs_items_movement v GROUP BY v.branch_no ########################## SUM(V.QUANTITY) --------------- 114453 2501 8137 13270 15230 120626 22536 2926 12848 37509 20911 7503 6248 17221 462 24 15041 10307 12524 526627 10564 8230 13204 2840 80769 1418238 215694 15238 5063 104187 913 147079 11293 12678 18855 35 rows selected
Must be scalar subqueries. You demonstrate your subquery returns more than one line. Where the error.
A solution would be to establish a correlation between the results of the subquery by joining the branch_id with branch_id of the outer query. However, as the two queries use the same table, you can simply use an analytical SUM():
SELECT v.code ,v.bar_code ,v.arb_name ,v.eng_name ,v.branch_no ,sum(quantity) over (partition by branch_no) as branch_tot FROM viw_whs_items_movement V
Cheers, APC
-
Update of several lines using the join condition
Hi all
CREATE OR REPLACE
PROCEDURE update_t
IS
BEGIN
SheikYerbouti IN (SELECT EMPLOYEE_ID, FIRST_NAME, LAST_NAME FROM hr.employees)
LOOP
UPDATE
HR.employees1
SET
FOCA =)
Select concat (FIRST_NAME, LAST_NAME) in the hr.employees where SheikYerbouti. EMPLOYEE_ID = 197);
END LOOP;
END update_t;
/
I'm trying to update column Foca Employees1 table. When I run this procedure, I get the error
Error report:
ORA-01427: einreihig subquery returns multiple rows
ORA-06512: at "SYSTEM. UPDATE_T", line 13
ORA-06512: at line 1
01427 00000 - "einreihig subquery returns several lines.
Please let me know a solution for this.
Thank you
MathonHello Mathieu,
in your internal SQL result set is not limited to just one line.
Try thisUPDATE hr.employees1 SET FIRST_LAST= (select concat(FIRST_NAME,LAST_NAME) from hr.employees where emp_rec.EMPLOYEE_ID=hr.employees.employee_id);
Your version had no restrictions on selected lines of hr.employees. You gave a where condition clause that is not related to the query.
The best solution for your problem is to avoid completely any PL/SQL loop. You can try something like this:
update (select e1.first_last, e.first_name, e.last_name from hr.employees1 e1, hr.employees e where e1.employee_id=e.employee_id) set first_last=first_name||last_name;
But beware, the updates on the joints work only under certain restrictions. The key of the table to be updated must be the join key. (key preserved is the word to look for).
Hope that helps,
dhalek -
Match pattern IMAQ 4 to superimpose several lines 2
Hello community OR,.
I have a problem connecting to the match pattern to superimpose several lines 2.
I want to track an object from a video webcam.
In this help http://zone.ni.com/reference/en-XX/help/370281U-01/imaqvision/imaq_match_pattern_4/ it is said that the Matches (Pixels) (Bounding Box) must be connected to the superposition of several lines to the end of line Points. But I can't take the bounding box only. I tried the unbundling of the table 1 d of the clusters, but I can't do it.
Any help is appreciated. I can post a picture of my code if requested.
Thank you
Marwan Sabry
I'm sorry, it's an array of clusters.
-Therefore, index 0 for the first game.
-unbundling with name for encompassing and then pass it to overlay vi. -
> Now I'm unlable to select more number of lines that are not a sequence in a single page to copy the data rows and paste somewhere in one fell swoop.
> Is this concept implemented in Windows 7. ?
> Is there a provision (method) to select several lines that are not continuous across the keyboard or the mouse in windows 7?Byagaris,
It depends on what program you are trying to copy and paste into. You are able to select continuous, multiple lines, by using the Ctrl Key and clicking, or by highlighting the desired line. For example, I held the Ctrl key and then, using the mouse, has highlighted several different phrases in the various paragraphs, and could then copy them. This feature is available for several versions of windows.
If you are not able to perform this action then post what happens when you try and what program you try it.
Mike - Engineer Support Microsoft Answers
Visit our Microsoft answers feedback Forum and let us know what you think. -
I received an email for the diagnosis of the printer and I was prompted to install the updated drivers and I did it and now when I print the test page, I get several lines of text that displays only the top or the bottom 1/2 letters across the page, I printed a self-test diagnostic Page and printed everything in pink , but it does not print 1/2 letters across the page as a test page, then I printed a page of print quality and it did the same as the test page and it does the same thing as the test page, then I tried calibrate spacing of thought which may fix the problem but does not , what can I do?
Irven
Hi mmcmret8,
Thank you for your answer! It is possible that the print heads may need to be changed, at this point, I would recommend to you please call our hotline at the 800-474-6836. If you do not live in the United States / Canada region, please click the link below to get help from your region number. Language-country selector.
Best regards!
-
Vertically Center a LabelField several lines on a screen
Hello
I am trying to vertically align a LabelField several lines on a screen. This turns out to be more difficult than it should be. I am calculating the upper margin of the LabelField with:
int topEmptySpace = (Display.getHeight() - label.getPreferredHeight()) / 2; label.setMargin(topEmptySpace, 15, 0, 15);
It works, but only if the text in the LabelField is a single line. When it becomes multi-line, getPreferredHeight() value does not change, and therefore the LabelField is not perfectly in the Center. I saw a couple other posts about it, without a solution...
Thoughts? Thank you!
Because getPreferredHeight is just a suggestion. A field can know its peak that it is laid out. It is too late for setMargin (in general - there are all kinds of tricks). Fortunately, you can easily calculate the actual height your aura LabelField - multiply its getPreferredHeight by (
+ 1). Unlike many other text fields, LabelField never Word encapsulates and respect only line breaks. -
Several lines and pictures in a list
Anyone know the best way to make a list where each line consists of several lines of text and a picture as well?
I have to customization of the graphical component of the list?
Yes, you need to customize drawListRow. You can use setRowHeight if the height of the rows is too small.
You can use graphics methods to paint each line. -
Transfer incoming calls to several lines on 7960
Hi all
I hope someone can help out me. Some time ago, I came across a paper on Cisco's Web site that showed me how to transfer incoming calls to several lines on the same phone. I can't for the life of find me it.
The scenario is that I have a phone reception (7960) which has 6 buttons on line. I want incoming calls to its extension 926 to hit line 1 first, if this line is busy he stumbles on line 2 and so on.
I use Call Manager 4.2 at present that is currently configured with monitoring Console. I'm moving this phone to an another CUCM on 4.2 (it's complicated) with a view possibly to upgrade to the latest version. I won't use the monitoring I know, that they declined to support in his favor in later versions by opting for a standalone package. I distictly recall this document is written for version 4.x, when I found it. He spoke of creating new spaces of research of appellant as ReceptionL1_to_L2 to achieve the desired result.
Has anyone seen this document before and have a link to it? Or perhaps could suggest a better way to do this?
Thanks in advance for your help, much appreciated.
Hello
Here is the reference in addition to the good information of Manish
and Abhishek (5 of each)
How many calls per line working in Cisco CallManager 4.x
http://www.Cisco.com/en/us/products/SW/voicesw/ps556/products_tech_note09186a00801f3b4e.shtml
See you soon!
Rob
"Clocks go slow in a workplace.
"Drag to minutes and hours jerk."-Shock
-
Master / detail: several lines in detail are selected default
Hello world
I use Jdev 12 c and facing a problem, in a scenario of master / detail, several lines are by default selected in the secondary table, I checked the line selection unique option in the configuration of the table. Please see the snapshot for clarity.
Help, please
Kind regards
Crusher
You normally see this problem when the vo or eo is not a primary key defined. Check that each OT and vo should have a defined primary key that is unique for the vo.
Timo
-
Hello world!
As I said... is it possible to update several lines in the studio ODI 12 c?
Thanks anyway!
Can you close the thread and then marking it as answered.
-
Insert several lines in trigger?
can someone tell me how can I insert several lines in a trigger. I tried several ways, and so far nothing works.
create or replace
USER_GROUPS_TRIG RELAXATION
before INSERT ON USER_GROUPS
FOR EACH LINE
DECLARE
number of max_id;
BEGIN
SELECT TO_NUMBER (new_id) + 1 as new_id in max_id OF NEW_ID_VW;
INSERT THE TBL1
(USER NAME) VALUES
(max_id,: NEW.) (NEW); -It works very well and needs no adjustment, 1 inserted row.
MERGE INTO GROUP_MAPPING HAS
USING (SELECT USER_ID, GROUP_ID ADMIN_GROUPS_VW) B
ON (A.USER_ID = B.USER_ID)
WHEN NOT MATCHED THEN
INSERT (A.USER_ID, A.GROUP_ID)
values (b.user_id, b.group_id);
-FOR V IN 1.10 IN LOOP
-INSERTION IN GROUP_MAPPING (user_id, group_id)
-(select user_id, group_id from admin_groups_vw);
-END LOOP;
-INSERT IN GROUP_MAPPING
--(USER_ID, GROUP_ID) VALUES
-(max_id, (select group_id from admin_groups_vw));
-None of these POPs an error, just does not have the insert (there are several records, so there should be several inserted rows), I tried to insert, loop and fusion.
END;
Thanks for any help.
Hello
Whenever you have a problem, please post a small example data (CREATE TABLE and only relevant columns, INSERT statements) of all the tables involved, so that people who want to help you can recreate the problem and test their ideas.
Also post the exact results you want from this data, as well as an explanation of how you get these results from these data, with specific examples.
If you ask on a DML statement, such as CREATE TABLE, INSERT, INSERT statements must re-create the tables as they are to the DML, and the results will be the content of the or a modified tables when it's all over.
In this case, after complete relaxation and a DML statement that triggers, too.
Always say what version of Oracle you are using (for example, 11.2.0.2.0).
See the FAQ forum: Re: 2. How can I ask a question on the forums?
Is admin_groups_vw a notice? This it is, and the view depends on the table you are inserting (user_groups), then you will get a runtime error because the picture is changing. A FOR EACH ROW trigger on user_groups can't question user_groups. You said: "none of these POPs an error", but are you sure you're not getting a runtime error and just hide?
-
Help to extract data Clob to a column in a table that has several lines in a table
Help to extract data Clob to a column in a table that has several lines in a table
It works for only the first line
CREATE or REPLACE DIRECTORY XMLDIR AS ' / orabackups';
Grant read, write on DIRECTORY XMLDIR to the public;
() dbms_xslprocessor.clob2file
beef in CLOB,
XMLDIR IN VARCHAR2,
"testfile2.txt" IN VARCHAR2);
DECLARE
buf CLOB.
BEGIN
SELECT H15_DOC
IN buf
OF H15TEST. H15_STAGE
where rownum = 1;
dbms_xslprocessor.clob2file (buf, 'XMLDIR', 'testfile2.txt');
END;
/
-This error code
CREATE or REPLACE DIRECTORY XMLDIR AS ' / orabackups';
Grant read, write on DIRECTORY XMLDIR to the public;
() dbms_xslprocessor.clob2file
XData in CLOB,
XMLDIR IN VARCHAR2,
"testfile2.txt" IN VARCHAR2,
CSID in NUMBER: = 0);
DECLARE
CURSOR xmlmycur IS SELECT H15_DOC
OF H15TEST. H15_STAGE
where rownum = 102140;
l_clob CLOB.
XData CLOB.
BEGIN
DBMS_LOB.CREATETEMPORARY (l_clob, true);
DBMS_LOB.CREATETEMPORARY (xdata, true);
OPEN xmlmycur.
LOOP
SEEK xmlmycur INTO xdata;
dbms_xslprocessor.clob2file (xdata, 'XMLDIR', 'testfile2.txt');
EXIT WHEN xmlmycur % notfound;
END LOOP;
CLOSE Xmlmycur;
END;
/
ORA-21560: 3 argument is null, invalid or out of range
ORA-06512: at "SYS." DBMS_LOB", line 991
ORA-06512: at "XDB". DBMS_XSLPROCESSOR', line 324
ORA-06512: at line 15 level
FYI, it seems that the file being created will exceed 5 gig
Yes, it is a known issue with DBMS_XSLPROCESSOR.clob2file with big files.
Here is a slightly modified version of the code that I posted earlier, fixing WRITE_ERROR except:
DECLARE
v_file utl_file.file_type;
-write a unique to clob
procedure write_clob (p_content in clob) is
v_buffer varchar2 (32767).
V_POSITION pls_integer: = 1;
v_amount pls_integer: = 32767;
Start
loop
Start
DBMS_LOB. Read (p_content, v_amount, v_position, v_buffer);
exception
When no_data_found then exit;
end;
UTL_FILE.put_raw (v_file, utl_raw.cast_to_raw (v_buffer), true);
V_POSITION: = v_position + v_amount;
end loop;
end;
BEGIN
-Open the file
v_file: = utl_file.fopen ('TEST_DIR', 'testfile2.txt', 'wb', 32767);
-loops through the lines
for r in)
Select h15_doc
of h15test.h15_stage
)
loop
write_clob (r.h15_doc);
end loop;
UTL_FILE.fclose (v_file);
END;
/
-
Hello
I use several lines of flight path images, and when the mouse is hovering over an image rollover on the second row or below the image that is supposed to appear appears on the image at the top of its column. Any help would be appreciated, I've tried everything I can and can not find a way to solve this problem. If you need videos or screenshots of the problem, DOM Panel or code please ask. Thank you
I'm on a mac on Yosemite and spin the latest version of dreamweaver
Until you find permanent web hosting, do a Google search for free web hosting. You will find a lot out there that you can use for temporary testing & debugging.
Nancy O.
Maybe you are looking for
-
How to stop Firefox for Android to crash on my Kindle Fire.
Installed OK, but when I opened, opening page appears, takes about 5 seconds and then disappears. How can I stop this?
-
I used the same setup file, but on 1 pc, the "Open new tab" button is available in the menu 'Customize toolbar' and can be dragged and drop on the navigation bar. On the other pc, the "Open new tab" button/icon is not yet available for drag / drop. I
-
I can't connect to the microsoft/windows update system
no error to come, just that the Web page cannot be displayed, even more I tried different microsoft addresses to microsoft/windows update Center. Have tried @ different times of the day and night. Don't have login once yesterday and has recovered par
-
The PowerConnect 5524 ARP Cache size
Does anyone know powerconnect 5524 size of the ARP cache? I used the command: "show arp" to the PowerConnect 6248 switch, I got information: cache size is 1024. I can't got the PowerConnect 5524 information. Thank you. Core-6248 #show arp age time (s
-
How to uninstall and reinstall photoshop CS6?Herbert