*URGENT ORA-01427 single row subquery
I am trying to do this:
UPDATE projectdetails SET projectdetails.projectname=
(SELECT projectid FROM project WHERE projectdetails.projectname = project.projectname);
but it returns with the error: single row subquery returns more than 1 row.
I tried in the same PROJECTDETAILS table with another table A3, it works fine. but not for the PROJECT table.
Below is the project table (i have 2055 rows)
projectid
projectname
1
NEWEST
2
PARK WEST
3
THE VISION
4
PEOPLE'S PARK CENTRE
5
REFLECTIONS AT KEPPEL BAY
6
THE CLIFT
7
CLEMENTIWOODS CONDOMINIUM
8
HUNDRED TREES
9
PASIR VIEW PARK
10
CARABELLE
11
PARC IMPERIAL
below is the projectdetails table:
Projectname
CORALS AT KEPPEL BAY
2024750
2294
883
Strata
1
01 to 05
Jun-13
99 yrs lease commencing from 2007
1
CORALS AT KEPPEL BAY
2786880
1890
1475
Strata
1
01 to 05
Jun-13
99 yrs lease commencing from 2007
1
CORALS AT KEPPEL BAY
1525050
2180
700
Strata
1
01 to 05
Jun-13
99 yrs lease commencing from 2007
1
ECHELON
2162980
1647
1313
Strata
1
21 to 25
Jun-13
99 yrs lease commencing from 2012
1
WHITEHAVEN
1356000
1285
1055
Strata
1
01 to 05
Jun-13
Freehold
1
Hi ,
UPDATE projectdetails SET projectdetails.projectname=
(SELECT projectid FROM project WHERE projectdetails.projectname = project.projectname);
For any query, to test and excecute do as follow.
Break the query like
1. UPDATE projectdetails SET projectdetails.projectname=
2. (SELECT projectid FROM project WHERE projectdetails.projectname = project.projectname);
Run the select statement and you can identify ..
as the error defines the select statement is getting more than 1 value.
3. Check the 'Where' conditions each and every line, by commenting line by line and running the query.
You can resolve step by step, be confident bro we are with you.
I suggest you before updating all the rows, just try to update one row and test, if its working fine and you can update all.
Regards,
Afzal.
Similar Messages
-
TWO ERRO ORA-01427: single-row subquery returns more than one row
Hi,
I have a procedure which contains a cursor. If i run the select statement in the cursor separetly, it returns only value and works fine. But the same select statement in the cursor of a procedure throws me the error as below:
TWO ERRO ORA-01427: single-row subquery returns more than one row
Not sure what going on...any help appreciated.
Below is the select statement:
SELECT DISTINCT PSE.PARENT_POSITION_ID,
(SELECT DISTINCT PPD1.SEGMENT2
FROM PER_POSITION_DEFINITIONS PPD1,
HR_ALL_POSITIONS_F HAPF2,
PER_POS_STRUCTURE_ELEMENTS PSE2
WHERE TRUNC(SYSDATE) BETWEEN
HAPF2.EFFECTIVE_START_DATE AND
HAPF2.EFFECTIVE_END_DATE
AND PPD1.POSITION_DEFINITION_ID =
HAPF2.POSITION_DEFINITION_ID
AND
HAPF2.POSITION_ID = PSE2.PARENT_POSITION_ID
AND PSE2.PARENT_POSITION_ID =
PSE.PARENT_POSITION_ID
AND ROWNUM = 1) SEGMENT2,
(SELECT DISTINCT PAPF1.FIRST_NAME || ' ' ||
PAPF1.LAST_NAME CHIEF_NAME
FROM PER_ALL_PEOPLE_F PAPF1,
PER_ALL_ASSIGNMENTS_F PAAF1
WHERE TRUNC(SYSDATE) BETWEEN
PAPF1.EFFECTIVE_START_DATE AND
PAPF1.EFFECTIVE_END_DATE
AND TRUNC(SYSDATE) BETWEEN
PAAF1.EFFECTIVE_START_DATE AND
PAAF1.EFFECTIVE_END_DATE
AND PAAF1.POSITION_ID = PSE.PARENT_POSITION_ID
AND PAPF1.PERSON_ID = PAAF1.PERSON_ID
AND ROWNUM = 1) CHIEF_NAME
FROM PER_POS_STRUCTURE_ELEMENTS PSE,
HR_ALL_POSITIONS_F HAPF,
PER_POSITION_DEFINITIONS PPD
WHERE PSE.SUBORDINATE_POSITION_ID = 52744
AND TRUNC(SYSDATE) BETWEEN HAPF.EFFECTIVE_START_DATE AND
HAPF.EFFECTIVE_END_DATE
AND HAPF.POSITION_ID = PSE.SUBORDINATE_POSITION_ID
AND HAPF.POSITION_DEFINITION_ID = PPD.POSITION_DEFINITION_ID;
Thanks
PK
Edited by: user539616 on Jun 30, 2009 6:30 PMHi,
The cursor has a different parameter? Maybe the query is not exactly the same. Could you check this?
This is your query (formatted):
SELECT DISTINCT PSE.PARENT_POSITION_ID,
(SELECT DISTINCT PPD1.SEGMENT2
FROM PER_POSITION_DEFINITIONS PPD1,
HR_ALL_POSITIONS_F HAPF2,
PER_POS_STRUCTURE_ELEMENTS PSE2
WHERE TRUNC(SYSDATE) BETWEEN HAPF2.EFFECTIVE_START_DATE AND
HAPF2.EFFECTIVE_END_DATE
AND PPD1.POSITION_DEFINITION_ID = HAPF2.POSITION_DEFINITION_ID
AND HAPF2.POSITION_ID = PSE2.PARENT_POSITION_ID
AND PSE2.PARENT_POSITION_ID = PSE.PARENT_POSITION_ID
AND ROWNUM = 1) SEGMENT2,
(SELECT DISTINCT PAPF1.FIRST_NAME || ' ' || PAPF1.LAST_NAME CHIEF_NAME
FROM PER_ALL_PEOPLE_F PAPF1,
PER_ALL_ASSIGNMENTS_F PAAF1
WHERE TRUNC(SYSDATE) BETWEEN PAPF1.EFFECTIVE_START_DATE AND
PAPF1.EFFECTIVE_END_DATE
AND TRUNC(SYSDATE) BETWEEN PAAF1.EFFECTIVE_START_DATE AND
PAAF1.EFFECTIVE_END_DATE
AND PAAF1.POSITION_ID = PSE.PARENT_POSITION_ID
AND PAPF1.PERSON_ID = PAAF1.PERSON_ID
AND ROWNUM = 1) CHIEF_NAME
FROM PER_POS_STRUCTURE_ELEMENTS PSE,
HR_ALL_POSITIONS_F HAPF,
PER_POSITION_DEFINITIONS PPD
WHERE PSE.SUBORDINATE_POSITION_ID = 52744
AND TRUNC(SYSDATE) BETWEEN HAPF.EFFECTIVE_START_DATE AND HAPF.EFFECTIVE_END_DATE
AND HAPF.POSITION_ID = PSE.SUBORDINATE_POSITION_ID
AND HAPF.POSITION_DEFINITION_ID = PPD.POSITION_DEFINITION_ID;Tips: To put formatted code you must use {noformat}{noformat} tags, start tag and end tag are the same,you don't need to put '/' in the close tag.
Regards, -
ORA-01427 single-row subquery returns more than requested number of rows
Hi All,
SR#3-5155460391
When opening the Expense report form the given error occurs.
This is happening with only one employee.
The condition could not be evaluated because of error ORA-01427
single-row subquery returns more than requested number of rows.
query is:
select pea.segment5
from
per_all_assignments_f paf,
pay_personal_payment_methods_f ppm,
pay_external_accounts pea,
fnd_application fap,
fnd_id_flex_structures ffs
where
paf.person_id=:employee_id
and paf.primary_flag='Y'
and paf.assignment_type='E'
and trunc(sysdate) between paf.effective_start_date and paf.effective_end_date
and ppm.assignment_id=paf.assignment_id
and trunc(sysdate) between ppm.effective_start_date and ppm.effective_end_date
and ppm.attribute2='Y'
and pea.external_account_id=ppm.external_account_id
and pea.id_flex_num=ffs.id_flex_num
and fap.application_short_name='PAY'
and ffs.application_id=fap.application_id
and ffs.id_flex_code='BANK'
and ffs.id_flex_structure_code='GB_BANK_DETAILS';
Thanks,
Shikha
Edited by: user10456902 on Feb 3, 2012 1:57 AMHi,
First try to find pea.external_account_id from per_all_people_f,per_all_assignments_f,fnd_application.fnd_id_flex_structures etc
and then find
SELECt pea.segment5
FROM pay_external_accounts pea
WHERE pea.external_account_id = : external_account_id -- derived from SQL1
and check how many rows are returned -
ORA-01427: single-row subquery returns more than one row
I have a problem something like this:
table A
id col1 after_update
1 ? 11
2 ? 22
3 ? 33
3 ? 44
3 ? 55
4 ? 66
5 ? 88
5 ? ? /* won't be updated */
6 ? 99
7 ? null /* updated to null */
9 ? 20
table B
id col2
1 11
2 22
3 33
3 44
3 55
4 66
4 77
5 88
6 99
8 10
9 20
When I try the query:
update table A
set col1 = (select distinct col2 from table B) it gives me the error ORA-01427: single-row subquery returns more than one row
When I try the query:
update (select x.col1 x_col1,y.col2 y_col2
from (select id,col1,row_number() over (partition by id order by null /*col1*/) rn
from table_a
) x,
(select id,col2,row_number() over (partition by id order by col2) rn
from table_b
) y
where x.id = y.id
and x.rn = y.rn
set x_col1 = y_col2
it gives me an error saying ora-01779 :cannot modify a column which maps to a non key- preserved table. It shows the same even when I add the key to the tables.
My Database version is Oracle Database 11g Enterprise Edition Release 11.2.0.1.0
Kindly help.Another way, not waterproof too relay on rowid, but in your case it could work.
You have to verify it by yourself
update test_a aa
set col1 =
(select b.col1 from
(select
id, col1
,row_number() over
(partition by id order by col1) rn
from table_b) b,
( select
rowid, id, col1
,row_number() over (partition by id order by col1) sort_order
from test_a
) a
where
a.id=b.id
and
sort_order = rn
and
aa.rowid=a.rowid
)Edited by: chris227 on 03.04.2013 06:42
Table name corrected -
ORA-01427: single-row subquery returns more than one row HELP
I need to update baemployee.Stock_nbr field with select substr(C.CHECK_DIGIT, 3, 10)
from EMP_CHECK_DIG c where C.EMPLOYEE = e.EMPLOYEE
Please help.
update baemployee e
set Stock_nbr = (select substr(C.CHECK_DIGIT, 3, 10)
from EMP_CHECK_DIG c where C.EMPLOYEE = e.EMPLOYEE)
where exists
(select C.CHECK_DIGIT
from EMP_CHECK_DIG c where C.EMPLOYEE = e.EMPLOYEE)
and exists (select 1 from EMPLOYEE ee where ee.employee = e.employee and ee.emp_status like 'A%');
ORA-01427: single-row subquery returns more than one rowHi,
Welcome to the forum!
Whenever you have a question, please post some sample data, so that people can re-create the problem and test their solutions.
CREATE TABLE and INSERT statements, like the ones below, are great:
CREATE TABLE baemployee
( employee NUMBER (4)
, stock_nbr VARCHAR2 (10)
INSERT INTO baemployee (employee, stock_nbr) VALUES (1234, 'FUBAR');
CREATE TABLE employee
( employee NUMBER (4)
, emp_status VARCHAR2 (10)
INSERT INTO employee (employee, emp_status) VALUES (1234, 'ACTIVE');CREATE TABLE AS is good, too:
CREATE TABLE emp_check_dig
AS SELECT 1234 AS employee, 'AA1234567890ZZZ' AS check_digit FROM dual
UNION ALL SELECT 1234, 'AA2121212121ZZZ' FROM dual
;Also post the results you want from that data. In this case, the results would be the contents of the baemployee table after you run the UPDATE.
Would you want:
employee stock_nbr
1234 1234567890or would you want
employee stock_nbr
1234 2121212121If you run the UPDATE statement you posted with the data above, you'll get the "ORA-01427: single-row subquery returns more than one row" error, and you can see what causes it: there is more than one row from emp_check_dig that could be used to UPDATE the same row of baemployee. Say what you want to do in this situation (and why), and someone will help you find a way to do it. -
ORA-01427: single-row subquery returns more than one row -- no solution
Hello to all:
I have to tables:
Table a anwender (Email,Dept). --> all fields are filled
Table b dingo (Name,email,dept) --> all fields are filled
I now want to update the table a with the data from table b:
update anwender a set a.abteilung = ( select distinct b.abteilung from dingo b where b.email = a.email);
Then I got the error: ORA-01427: single-row subquery returns more than one row
Every dept is about 100x in the database, so it is clear that i got more than one row back. But how can I update the table now?Okay, I got several duplicates, and I deletet a lot of data in my database.
Now I want to remove all entries with more than one departments per mail adresses.
a
select email,count(abteilung) from dingo group by email having count(abteilung)>1 order by count(abteilung)
shows me all the fake mailadresses.
But a
delete from dingo where email in (select email,count(abteilung) from dingo group by email having count(abteilung)>1 order by count(abteilung) );
gives me a
SQL Error: ORA-00907: missing right parenthesis
I´m very confused now ...
Oops, now I got the solution:
delete from dingo where email in (select email from (select email,count(abteilung) from dingo group by email having count(abteilung)>1 )) ;
Edited by: user8309218 on Dec 18, 2009 6:24 AM -
Hi All
I have facing the Single row sub query Error . I tried to resolve , but my condition not working .can please any help to rewrite the query (sub query)
SELECT DISTINCT wdlsv.serial_number
,wdlsv.date_shipped
,wdlsv.inventory_item_id
,wdlsv.organization_id
,wdlsv.lot_number
,(select distinct engine from xxtc_tr_pr_open_data where chassis=wdlsv.serial_number and rownum=1
union
select distinct replace(replace(attribute11,'*',''),' ','')
from xxtc_chassis_scanout_details
where serial_number=wdlsv.serial_number
and operation_line_code ='CHASSIS') "ENGINE_NO"
,oola.attribute1 oh_excise_no
,msi.attribute16 vehicle_type
,bbom.attribute2 model_no
,xxst.tariff_code tariff_code
,substr(xxst.color_type,1,1) color_type
,(SELECT TO_CHAR(trunc(rt.transaction_date),'RRRRMMDD')
FROM rcv_transactions rt,
rcv_shipment_lines rsl,
rcv_shipment_headers rsh
WHERE rsh.shipment_header_id=rsl.shipment_header_id
AND rt.shipment_header_id=rsl.shipment_header_id
AND rsl.attribute1=wdlsv.lot_number
AND rt.organization_id=wdlsv.organization_id
AND rt.organization_id=rsh.organization_id
AND ROWNUM<=1
union
select distinct to_char(xxtp.indent_import_date,'RRRRMMDD')
from xxtc_tr_pr_open_data xxtp
where xxtp.chassis = wdlsv.serial_number) "CKD_IMPORT_DATE_YEAR"
,to_char(xxtp.indent_import_date,'RRRRMMDD') import_date
FROM WSH_DELIVERY_LINE_STATUS_V WDLSV
,oe_order_headers_all ooha
,oe_order_lines_all oola
,mtl_system_items_b msi
,bom_bill_of_materials bbom
,xxtc_sales_tax_cal xxst
WHERE 1=1
AND PICK_STATUS = 'C'
AND delivery_status = 'CL'
AND ooha.header_id = wdlsv.source_header_id
AND ooha.header_id = oola.header_id
AND oola.line_id = wdlsv.source_line_id
AND msi.inventory_item_id = wdlsv.inventory_item_id
AND msi.organization_id = wdlsv.organization_id
AND bbom.assembly_item_id = wdlsv.inventory_item_id
AND bbom.organization_id = wdlsv.organization_id
AND xxst.inventory_item_id = wdlsv.inventory_item_id
AND xxst.organization_id = wdlsv.organization_id
and upper(msi.attribute15) not like 'SUB%'
AND WDLSV.SERIAL_NUMBER IS NOT NULL;
Regards
SanjayThis forum is for questions about working with SQL*Developer. The title is "SQL Developer (Not for general SQL/PLSQL questions)" and yours is a general SQL question. You should get a better answer by re-posting in the SQL and PL/SQL forum in the Oracle Database section. Please mark this tread as answered and re-post there.
-
Hi Jeff,
I'm using the EA2 since September 13th and I found this error when I execute several reports against RAC (2 nodes) databases.
For ex. in the DBA panel , under Performance option, when I try to run ASH for las 5 minutes, the ORA-01427 come out immediately.
I just want to be sure you are already aware of this issue and taken into account for future release.
Thanks in advance,
Andraly Nghahaha, now I goit it (I read your profile in ThatJeffSmith), but I'm sure you're the right "Jeff"
Thank you so much for your priceless work! -
ORA-01427:single-row sub query returns more than one row (group by)
Hello every one, I am very new to this field , and Right now I am working with this sql, where BEG_BAL_WKST,WKST_RECEIVED_NUM,WKST_PROCESSED_NUM,WKST_CANCELED_NUM are needs to be grouped by,but I am getting the "single-row sub query returns more than one row".
This is the query I am using in my source qualifier:
select
SUM(tmp.WIP_TO_BILL_LOC_AMT) AS WIP_TO_BILL_LOC_AMT,
sum(tmp.REALIZATION_LOC_AMT) AS REALIZATION_LOC_AMT,
SUM(tmp.NEG_REAL_LOC_AMT) AS NEG_REAL_LOC_AMT,
sum(tmp.POS_REAL_LOC_AMT) AS POS_REAL_LOC_AMT,
sum(tmp.BILL_IN_ADVANCE_LOC_AMT) AS BILL_IN_ADVANCE_LOC_AMT,
sum(tmp.CARRY_FORWARD_LOC_AMT) AS CARRY_FORWARD_LOC_AMT,
sum(tmp.BILL_TO_CLIENT_LOC_AMT) AS BILL_TO_CLIENT_LOC_AMT,
sum(tmp.REMAIN_WIP_TO_BILL_LOC_AMT) REMAIN_WIP_TO_BILL_LOC_AMT,
sum(tmp.AR_INV_AMT) AS AR_INV_AMT,
sum(tmp.AR_TAX_AMT) AS AR_TAX_AMT,
tmp.BEG_BAL_WKST_NUM AS BEG_BAL_WKST_NUM,
tmp.WKST_RECEIVED_NUM AS WKST_RECEIVED_NUM,
tmp.WKST_PROCESSED_NUM AS WKST_PROCESSED_NUM,
tmp.WKST_CANCELED_NUM AS WKST_CANCELED_NUM,
tmp.DURATION AS DURATION,
tmp.NUM_DAYS AS NUM_DAYS,
tmp.NUM_HOURS AS NUM_HOURS,
tmp.NUM_MINUTES AS NUM_MINUTES,
tmp.NUM_SECONDS AS NUM_SECONDS,
tmp.LEAD_PROJECT_OFFICE_CODE AS LEAD_PROJECT_OFFICE_CODE,
tmp.LEAD_PROJECT_TEAM_CODE AS LEAD_PROJECT_TEAM_CODE,
tmp.ORG_ID AS ORG_ID,
tmp.RPT_DATE AS RPT_DATE,
tmp.RPT_DATE_WID AS RPT_DATE_WID,
tmp.LOCAL_CURR_CODE AS LOCAL_CURR_CODE,
tmp.USD_EXCH_RATE AS USD_EXCH_RATE,
tmp.EUR_EXCH_RATE AS EUR_EXCH_RATE,
tmp.GBP_EXCH_RATE AS GBP_EXCH_RATE
from(
SELECT
WIP_TO_BILL_LOC_AMT as WIP_TO_BILL_LOC_AMT ,
REALIZATION_LOC_AMT AS REALIZATION_LOC_AMT,
NEG_REAL_LOC_AMT AS NEG_REAL_LOC_AMT ,
POS_REAL_LOC_AMT AS POS_REAL_LOC_AMT,
BILL_IN_ADVANCE_LOC_AMT AS BILL_IN_ADVANCE_LOC_AMT ,
CARRY_FORWARD_loc_AMT AS CARRY_FORWARD_LOC_AMT,
bill_to_client_LOC_AMT AS BILL_TO_CLIENT_LOC_AMT ,
REMAIN_WIP_TO_BILL_LOC_AMT AS REMAIN_WIP_TO_BILL_LOC_AMT,
AR_inv_AMT AS AR_INV_AMT,
ar_tax_amt AS AR_TAX_AMT,
(SELECT count(distinct(RPAD(INTEGRATION_ID,32)))
FROM wc_twfs_olb_invoice_history_f
WHERE ((inv_status_type='FIN'AND inv_status_code NOT IN ('COMPLETE','PROCESSED'))
OR (inv_status_type='WS' AND inv_status_code NOT IN ('PRC'))) --COMPLETED
AND to_char((sysdate-5),'YYYYMMDD') between to_char(status_start_dt,'YYYYMMDD') and to_char(status_end_dt,'YYYYMMDD')group by rpad(integration_id,32)) AS BEG_BAL_WKST_NUM ,
(SELECT count(distinct(RPAD(INTEGRATION_ID,32)))
FROM wc_twfs_olb_invoice_history_f
WHERE (inv_status_code='NEW')
AND to_char((sysdate-4),'YYYYMMDD') between to_char(status_start_dt,'YYYYMMDD') and to_char(status_end_dt,'YYYYMMDD')group by rpad(integration_id,32))AS WKST_RECEIVED_NUM ,
(SELECT count(distinct(RPAD(INTEGRATION_ID,32)))
FROM wc_twfs_olb_invoice_history_f
WHERE ((inv_status_type='FIN' and inv_status_code IN ('COMPLETE','PROCESSED'))
OR (inv_status_type='WS' AND inv_status_code IN ('PRC'))) --COMPLETED
AND to_char((sysdate-4),'YYYYMMDD') between to_char((status_start_dt),'YYYYMMDD') and to_char((status_end_dt),'YYYYMMDD')group by rpad(integration_id,32))AS WKST_PROCESSED_NUM ,
(SELECT count(distinct(RPAD(INTEGRATION_ID,32)))
FROM wc_twfs_olb_invoice_history_f
WHERE (inv_status_type='FIN' AND inv_status_code='CANCELLED')
AND to_char((sysdate-4),'YYYYMMDD') between to_char((status_start_dt),'YYYYMMDD') and to_char((status_end_dt),'YYYYMMDD')group by rpad(integration_id,32)) AS WKST_CANCELED_NUM,
DURATION AS DURATION,
NUM_DAYS AS NUM_DAYS,
NUM_HOURS AS NUM_HOURS,
NUM_MINUTES AS NUM_MINUTES,
NUM_SECONDS AS NUM_SECONDS,
lead_project_office_code AS LEAD_PROJECT_OFFICE_CODE,
lead_project_team_code AS LEAD_PROJECT_TEAM_CODE,
org_id AS ORG_ID,
trunc(sysdate-1) AS RPT_DATE,
to_char((sysdate-1),'YYYYMMDD') AS RPT_DATE_WID,
--last_day(a.report_date) mth_end_dt,
LOC_CURR_CODE AS LOCAL_CURR_CODE,
usd_exch_rate AS USD_EXCH_RATE,
eur_exch_rate AS EUR_EXCH_RATE,
gbp_exch_rate AS GBP_EXCH_RATE
FROM Wc_twfs_olb_invoice_history_f
Where
RPT_DT_MCAL_PERIOD_WID =(select max(RPT_DT_MCAL_PERIOD_WID)from Wc_twfs_olb_invoice_history_f))tmp
group by BEG_BAL_WKST_NUM,WKST_RECEIVED_NUM,WKST_PROCESSED_NUM,WKST_CANCELED_NUM,DURATION,NUM_DAYS,NUM_HOURS,NUM_MINUTES,NUM_SECONDS,
LEAD_PROJECT_OFFICE_CODE,LEAD_PROJECT_TEAM_CODE,ORG_ID,RPT_DATE,RPT_DATE_WID,
LOCAL_CURR_CODE,USD_EXCH_RATE,EUR_EXCH_RATE,GBP_EXCH_RATE;
Can you please suggest me what to do next, and what would be the solution to this.
Thanks a lot in advance. please show me some direction.you may want to change it something like
SELECT SUM(Wip_To_Bill_Loc_Amt) AS Wip_To_Bill_Loc_Amt,
SUM(Realization_Loc_Amt) AS Realization_Loc_Amt,
SUM(Neg_Real_Loc_Amt) AS Neg_Real_Loc_Amt,
SUM(Pos_Real_Loc_Amt) AS Pos_Real_Loc_Amt,
SUM(Bill_In_Advance_Loc_Amt) AS Bill_In_Advance_Loc_Amt,
SUM(Carry_Forward_Loc_Amt) AS Carry_Forward_Loc_Amt,
SUM(Bill_To_Client_Loc_Amt) AS Bill_To_Client_Loc_Amt,
SUM(Remain_Wip_To_Bill_Loc_Amt) AS Remain_Wip_To_Bill_Loc_Amt,
SUM(Ar_Inv_Amt) AS Ar_Inv_Amt,
SUM(Ar_Tax_Amt) AS Ar_Tax_Amt,
COUNT(DISTINCT CASE
WHEN ((Inv_Status_Type = 'FIN' AND
Inv_Status_Code NOT IN ('COMPLETE', 'PROCESSED')) OR
(Inv_Status_Type = 'WS' AND Inv_Status_Code NOT IN ('PRC'))) --COMPLETED
AND To_Char((SYSDATE - 5), 'YYYYMMDD') BETWEEN
To_Char(Status_Start_Dt, 'YYYYMMDD') AND
To_Char(Status_End_Dt, 'YYYYMMDD') THEN
Rpad(Integration_Id, 32)
END) AS Beg_Bal_Wkst_Num,
/*(SELECT COUNT(DISTINCT(Rpad(Integration_Id, 32)))
FROM Wc_Twfs_Olb_Invoice_History_f
WHERE ((Inv_Status_Type = 'FIN' AND
Inv_Status_Code NOT IN ('COMPLETE', 'PROCESSED')) OR
(Inv_Status_Type = 'WS' AND Inv_Status_Code NOT IN ('PRC'))) --COMPLETED
AND To_Char((SYSDATE - 5), 'YYYYMMDD') BETWEEN
To_Char(Status_Start_Dt, 'YYYYMMDD') AND
To_Char(Status_End_Dt, 'YYYYMMDD')
GROUP BY Rpad(Integration_Id, 32)) AS Beg_Bal_Wkst_Num,
(SELECT COUNT(DISTINCT(Rpad(Integration_Id, 32)))
FROM Wc_Twfs_Olb_Invoice_History_f
WHERE (Inv_Status_Code = 'NEW')
AND To_Char((SYSDATE - 4), 'YYYYMMDD') BETWEEN
To_Char(Status_Start_Dt, 'YYYYMMDD') AND
To_Char(Status_End_Dt, 'YYYYMMDD')
GROUP BY Rpad(Integration_Id, 32)) AS Wkst_Received_Num,
(SELECT COUNT(DISTINCT(Rpad(Integration_Id, 32)))
FROM Wc_Twfs_Olb_Invoice_History_f
WHERE ((Inv_Status_Type = 'FIN' AND
Inv_Status_Code IN ('COMPLETE', 'PROCESSED')) OR
(Inv_Status_Type = 'WS' AND Inv_Status_Code IN ('PRC'))) --COMPLETED
AND To_Char((SYSDATE - 4), 'YYYYMMDD') BETWEEN
To_Char((Status_Start_Dt), 'YYYYMMDD') AND
To_Char((Status_End_Dt), 'YYYYMMDD')
GROUP BY Rpad(Integration_Id, 32)) AS Wkst_Processed_Num,
(SELECT COUNT(DISTINCT(Rpad(Integration_Id, 32)))
FROM Wc_Twfs_Olb_Invoice_History_f
WHERE (Inv_Status_Type = 'FIN' AND Inv_Status_Code = 'CANCELLED')
AND To_Char((SYSDATE - 4), 'YYYYMMDD') BETWEEN
To_Char((Status_Start_Dt), 'YYYYMMDD') AND
To_Char((Status_End_Dt), 'YYYYMMDD')
GROUP BY Rpad(Integration_Id, 32)) AS Wkst_Canceled_Num,*/
Duration AS Duration,
Num_Days AS Num_Days,
Num_Hours AS Num_Hours,
Num_Minutes AS Num_Minutes,
Num_Seconds AS Num_Seconds,
Lead_Project_Office_Code AS Lead_Project_Office_Code,
Lead_Project_Team_Code AS Lead_Project_Team_Code,
Org_Id AS Org_Id,
Trunc(SYSDATE - 1) AS Rpt_Date,
To_Char((SYSDATE - 1), 'YYYYMMDD') AS Rpt_Date_Wid,
--last_day(a.report_date) mth_end_dt,
Loc_Curr_Code AS Local_Curr_Code,
Usd_Exch_Rate AS Usd_Exch_Rate,
Eur_Exch_Rate AS Eur_Exch_Rate,
Gbp_Exch_Rate AS Gbp_Exch_Rate
FROM Wc_Twfs_Olb_Invoice_History_f
WHERE Rpt_Dt_Mcal_Period_Wid =
(SELECT MAX(Rpt_Dt_Mcal_Period_Wid)
FROM Wc_Twfs_Olb_Invoice_History_f)
GROUP BY Beg_Bal_Wkst_Num,
Wkst_Received_Num,
Wkst_Processed_Num,
Wkst_Canceled_Num,
Duration,
Num_Days,
Num_Hours,
Num_Minutes,
Num_Seconds,
Lead_Project_Office_Code,
Lead_Project_Team_Code,
Org_Id,
Rpt_Date,
Rpt_Date_Wid,
Local_Curr_Code,
Usd_Exch_Rate,
Eur_Exch_Rate,
Gbp_Exch_Rate;Edited by: 986006 on Mar 4, 2013 1:08 PM -
Hi all,
I m getting error ORA-01427 single row subquery return more than one row when i execute the below query.
could some one help me in writing the below query
update dvd_genre set GENRE_I = (select GENRE_I from dvd_gen_data
where mov_name in (select mov_name from dvd_genre group by mov_name))
where mov_name in (select mov_name from dvd_gen_data group by mov_name)rgds
Saazsee:
SQL> select * from a;
IDX CNAME
1 e
2 f
SQL> select * from b;
IDX CNAME
1 c
2 d
1 e
2 f
SQL>
SQL> update a set cname=(
2 select cname from b
3 where idx=a.idx
4 );
update a set cname=(
select cname from b
where idx=a.idx
ORA-01427: single-row subquery returns more than one row
SQL>
SQL> update a set cname=(
2 select cname from (
3 select idx,max(cname) cname from b
4 group by idx
5 )
6 where idx=a.idx
7 );
2 rows updated
SQL> select * from a;
IDX CNAME
1 e
2 fEdited by: Garey on 2009-10-7 下午11:47 -
Discoverer 11g Workbook Fails With Single row subquery returns more than 1
All -
We are using discoverer-11g workbook using EBS 12.1.3 integration
We are seeing below error message only for few users on all workbooks in discoverer.
ORA-01427 Single row subquery returns more than one row
EBS Version : 12.1.3
Discoverer Version : 11.1.1.6
Database Version : 11.2.0.3
Please advise on this
Regards
VSHHi,
If it is happening for only a few users then the problem may be caused by security conditions built into the query. However, you need to give us some information about the SQL the workbooks are running. Do you get this error even for the very simple queries?
Rod West -
Still problem with single-row subquery returns more than one row
//i did join each table but query runs forever and fail. looks Cartesian join so comes up the following SQL
the following query has a problem. would you please help me, please
Select pe.expense_id
,PE.CODE
,PE.PROJECT_ID
,PE.LDATE
,PE.INAMOUNT pe_amount
,(SELECT TRX.INV_AMOUNT FROM TRXEXPENSES TRX
WHERE PE.EXPENSE_ID=TRX.EXPENSE_ID) AS invamount
,(SELECT RE.AMOUNT FROM REEXPENSES RE WHERE
PE.EXPENSE_ID=RE.EXPENSE_ID) AS recogamount
,(SELECT MLE.M_AMOUNT FROM MATEXPENSES MLE
WHERE PE.EXPENSE_ID=MLE.EXPENSE_ID) AS matamount
from EXPENSES PE
where pe.expense_id=5600
group by expense_id,CODE,PROJECT_ID,LDATE,inamount
//get error message
ora-01427:single-row subquery returns more than one row
//check database
select expense_id,count(*) from TRXEXPENSES
where expense_id in(select expense_id from
expenses)
group by expense_id
having count(*)>1
//here is duplicate record a lot
EXPENSE_ID COUNT(*)
4176 2
5600 3
9572 2
9573 2
9574 2Yes, Expense_id has so many returning rows for trx.inv_amount from trxexpenses in subquery.
I want to show Expense_id with retruning rows using the above query.
ex)The result of the query is like that;
Expense_ Id project_id Ldate InvAmount RecogAmount MatAmount
5600 123 3/2/02 $100(InvAmount)
5600 432 3/12/02 $200(recogAmount)
5600 432 4/12/02 $250(MatAmount)
Thank you so much
Message was edited by:
user524064
Message was edited by:
user524064 -
Update gives "single-row subquery returns more than one row"
Hi,
I have to update a table by getting values from two other tables. While doing that the inner query returns more than one value. I am not sure how to implement the logic without returning more than one row in sub quesry. Need help on that.
My query:
update buf_office_str o
set o.manager_ident =
(select sp.ident
from se2_r_src_sourceperson sp ,
(select distinct director_name, team_name from buf_sales_dump )t
where SP.SRCNAME = upper(substr(t.director_name,instr(t.director_name,' ')+1,length(t.director_name))||', '||substr(t.director_name,1,instr(t.director_name,' ')-1 ) )
and o.office_descr = t.team_name
Basically the query gets teh manager id from sp table where sp.srcname = t.team-name.
The office descr should be equal to the team_name.
This is the logic I am working towards:
For each office, i get the office_descr and get corresponding team_name. Match the team's director_name (from table t) with the sp.name and return the employee's id (sp.ident) for that office_descr.
I need to update all 50 offices with corresponding managerid for that office in buf_office_str table.
Is it possible to get done in one update? Pls let me know.Hi,
"Single-row subquery returns more than one row" is one of those error messages that actually means what it says: the correlated sub-query in your SET clause is sometimes returning 2 or more rows .
The solution could be as simple as making the sub-query SELECT DISTINCT , as its in-line view, t, already is.
It's possible you have bad data, or a mistake in your statement.
To find the problem cases, you can run something like this:
WITH sub_q AS
SELECT -- DISTINCT ?
sp.ident
, t.team_name
, COUNT (*) OVER (PARTITION BY t.team_name) AS cnt
FROM se2_r_src_sourceperson sp
, ( SELECT DISTINCT director_name
, team_name
FROM buf_sales_dump
) t
WHERE sp.srcname = UPPER ( SUBSTR ( t.director_name
, INSTR ( t.director_name
) + 1
, LENGTH (t.director_name)
|| ', '
|| SUBSTR ( t.director_name
, 1
, INSTR ( t.director_name
) - 1
SELECT o.* -- or whatever helps you
, sq.*
FROM buf_office_str o
JOIN sub_q sq ON o.office_descr = sq.team_name
WHERE sq.cnt > 1
;If you'd like more help, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables as they exist before the UPDATE, and the results you want from that data (that is, the contents of buf_office_str after the UPDATE). Make sure the problem occurs with the sample data you post. -
Error single row subquery returns multiple values
Hi All,
I have a below query. This is query is throwiing error like single row subquery is returing more than number of records. That subquery is in my SELECT statement query. I have a value like 'tests'. That test contains more than one record. I am fetching that 'tests' child values from this query. If the test contains only one child at that time it is working fine. Can anyone share with how update this query?
SELECT
czpn.FEATURE_TYPE,
czci.PS_NODE_NAME,
DECODE(czci.VALUE_TYPE_CODE,2,czci.ITEM_VAL,
3, NVL((SELECT
lines_config.PS_NODE_NAME
FROM
CZ_CONFIG_ITEMS lines_config
WHERE
lines_config.PARENT_CONFIG_ITEM_ID = czci.CONFIG_ITEM_ID
AND lines_config.CONFIG_HDR_ID = czci.CONFIG_HDR_ID
AND lines_config.CONFIG_REV_NBR = czci.CONFIG_REV_NBR),
DECODE(czci.ITEM_NUM_VAL,1,'',czci.ITEM_NUM_VAL)),
0,NVL(czci.ITEM_NUM_VAL,'')) NODE_VALUE
FROM
CZ_CONFIG_ITEMS czci,
CZ_PS_NODES czpn
WHERE
czpn.PERSISTENT_NODE_ID = czci.PS_NODE_ID
AND czci.CONFIG_HDR_ID = 1827349
AND czci.CONFIG_REV_NBR = 1
--AND czci.VALUE_TYPE_CODE <> 4
AND czpn.FEATURE_TYPE IS NOT NULL
--AND czci.PS_NODE_ID = 356474
AND czpn.DEVL_PROJECT_ID = (SELECT MAX(ps_devl1.DEVL_PROJECT_ID) FROM CZ_DEVL_PROJECTS ps_devl1, CZ_PS_NODES ps_devl, CZ_CONFIG_ITEMS ps_config_sub
WHERE (ps_devl.PERSISTENT_NODE_ID = ps_config_sub.PS_NODE_ID
AND ps_config_sub.PARENT_CONFIG_ITEM_ID = (SELECT ps_config_sub1.CONFIG_ITEM_ID FROM CZ_CONFIG_ITEMS ps_config_sub1
WHERE ps_config_sub.CONFIG_HDR_ID = ps_config_sub1.CONFIG_HDR_ID
AND ps_config_sub.CONFIG_REV_NBR = ps_config_sub1.CONFIG_REV_NBR
AND ps_config_sub1.PS_NODE_NAME = 'ACCESSORIES'))
AND ps_devl1.DEVL_PROJECT_ID = ps_devl.REFERENCE_ID
AND ps_config_sub.CONFIG_HDR_ID = czci.CONFIG_HDR_ID
AND ps_config_sub.CONFIG_REV_NBR = czci.CONFIG_REV_NBR)
AND czci.PS_NODE_NAME = 'tests'ThanksHello,
This should work:
SELECT
czpn.FEATURE_TYPE,
czci.PS_NODE_NAME,
DECODE(czci.VALUE_TYPE_CODE,2,czci.ITEM_VAL,
3, NVL((SELECT
lines_config.PS_NODE_NAME
FROM
CZ_CONFIG_ITEMS lines_config
WHERE
lines_config.PARENT_CONFIG_ITEM_ID = czci.CONFIG_ITEM_ID
AND lines_config.CONFIG_HDR_ID = czci.CONFIG_HDR_ID
AND lines_config.CONFIG_REV_NBR = czci.CONFIG_REV_NBR
AND ROWNUM <= 1),
DECODE(czci.ITEM_NUM_VAL,1,'',czci.ITEM_NUM_VAL)),
0,NVL(czci.ITEM_NUM_VAL,'')) NODE_VALUE
FROM
CZ_CONFIG_ITEMS czci,
CZ_PS_NODES czpn
WHERE
czpn.PERSISTENT_NODE_ID = czci.PS_NODE_ID
AND czci.CONFIG_HDR_ID = 1827349
AND czci.CONFIG_REV_NBR = 1
--AND czci.VALUE_TYPE_CODE 4
AND czpn.FEATURE_TYPE IS NOT NULL
--AND czci.PS_NODE_ID = 356474
AND czpn.DEVL_PROJECT_ID = (SELECT MAX(ps_devl1.DEVL_PROJECT_ID) FROM CZ_DEVL_PROJECTS ps_devl1, CZ_PS_NODES ps_devl, CZ_CONFIG_ITEMS ps_config_sub
WHERE (ps_devl.PERSISTENT_NODE_ID = ps_config_sub.PS_NODE_ID
AND ps_config_sub.PARENT_CONFIG_ITEM_ID = (SELECT ps_config_sub1.CONFIG_ITEM_ID FROM CZ_CONFIG_ITEMS ps_config_sub1
WHERE ps_config_sub.CONFIG_HDR_ID = ps_config_sub1.CONFIG_HDR_ID
AND ps_config_sub.CONFIG_REV_NBR = ps_config_sub1.CONFIG_REV_NBR
AND ps_config_sub1.PS_NODE_NAME = 'ACCESSORIES'))
AND ps_devl1.DEVL_PROJECT_ID = ps_devl.REFERENCE_ID
AND ps_config_sub.CONFIG_HDR_ID = czci.CONFIG_HDR_ID
AND ps_config_sub.CONFIG_REV_NBR = czci.CONFIG_REV_NBR)
AND czci.PS_NODE_NAME = 'tests'Where this is restricting the records returned by your columnar subquery to one record with ROWNUM. -
SINGLE ROW SUBQUERY....error
Hi Friends,
How do I modify my program to avoid "single row subquery" error.
UPDATE AR.HZ_CONTACT_POINTS B
SET B.PHONE_COUNTRY_CODE =
(SELECT D.PHONE_COUNTRY_CODE
FROM CAX.CAX_CUSTOMERS_ALL A,
AR.HZ_CONTACT_POINTS X,
AR.HZ_PARTY_SITES C,
AR.HZ_PHONE_COUNTRY_CODES D,
CAX.HZ_LOCATIONS_V E
WHERE ( A.ORG_ID=111
AND X.OWNER_TABLE_NAME='HZ_PARTY_SITES'
AND X.PHONE_NUMBER IS NOT NULL)
AND ( (C.LOCATION_ID=E.LOCATION_ID)
AND (X.OWNER_TABLE_ID=C.PARTY_ID)
AND (E.COUNTRY=D.TERRITORY_CODE)
AND (X.OWNER_TABLE_ID=A.CUSTOMER_ID)
AND (B.PHONE_NUMBER=X.PHONE_NUMBER)
WHERE B.OWNER_TABLE_NAME='HZ_PARTY_SITES'
AND B.PHONE_NUMBER IS NOT NULL;Thanks in advanceHi friends,
This is the sample data :
hz_contact_points
CONTACT_POINT_ID CONTACT_POINT_TYPE STATUS OWNER_TABLE_NAME OWNER_TABLE_ID PRIMARY_FLAG ORIG_SYSTEM_REFERENCE PHONE_NUMBER PHONE_LINE_TYPE CONTENT_SOURCE_TYPE RAW_PHONE_NUMBER CREATED_BY_MODULE APPLICATION_ID TRANSPOSED_PHONE_NUMBER
33,476 PHONE A HZ_PARTY_SITES 22,796 N 33476 3414510 FAX USER_ENTERED 3414510 TCA_BASE_UPGRADE_SCRIPT 222 0154143
33,475 PHONE A HZ_PARTY_SITES 22,796 Y 33475 2691028 GEN USER_ENTERED 2691028 TCA_BASE_UPGRADE_SCRIPT 222 8201962
hz_party_sites
PARTY_SITE_ID PARTY_ID LOCATION_ID PARTY_SITE_NUMBER STATUS CREATED_BY_MODULE APPLICATION_ID ACTUAL_CONTENT_SOURCE
23,182 22,796 3,975 23182 A TCA_BASE_UPGRADE_SCRIPT 222 USER_ENTERED
23,181 22,796 3,956 23181 A TCA_BASE_UPGRADE_SCRIPT 222 USER_ENTERED
hz_locations
LOCATION_ID LAST_UPDATE_DATE LAST_UPDATED_BY CREATION_DATE CREATED_BY ORIG_SYSTEM_REFERENCE COUNTRY ADDRESS1 CITY POSTAL_CODE STATE CREATED_BY_MODULE APPLICATION_ID ACTUAL_CONTENT_SOURCE GEOMETRY
3,956 15/Nov/07 07:16:12 PM 5,845 28/Jul/03 04:54:20 PM 3,282 23181 PA ZONA LIBRE DE COLON ,COLON.R.DE PANAMA. PANAMA NULL PANAMA TCA_BASE_UPGRADE_SCRIPT 222 USER_ENTERED (, , , , )
3,975 28/Jul/03 04:56:57 PM 3,282 28/Jul/03 04:56:57 PM 3,282 23182 US MURANO TRADING C/O QUARTZ ELECTRONICS 2555 NW 107 AVENUE . MIAMI 33172 FLORIDA TCA_BASE_UPGRADE_SCRIPT 222 USER_ENTERED (, , , , )***please ommit the comma for ID columns , as excel automatically inserts them for numeric
The problem lies with the specific connection between the tables
"hz_contact_points" and "hz_party_sites" which is linked by party_id which is also multiple record :(
Thanks again
Maybe you are looking for
-
Video quality bad when compresed from final cut pro to dvd studio pro. HELP
Hello, I have a dvd project im working on and first i tried the video that i captured from final cut to just use in dvd studio pro but that didnt work. then i used the compressor and used the 60min high quality video and that looks even worse. what d
-
Calling 'Status' screen of transaction IW32 from report
Hi, I want to display 'status overview' screen from transaction 'iw32' . I know how to call transaction 'iw32', but I don't know how can I directly go on status screen? I have order no with me. Can anyone help me?
-
ISync / Palm AddressBook sync problem
Supposedly I should be able to set up iSync so that iCal syncs with Palm DateBook but the Palm Desktop AddressBook continues to sync with the Addressbook on my handheld. Following the directions in the support document below to I have set up iSync to
-
Sample Command Output of show chassis inventory for CSS
Hi, I am trying to get a sample command output of "show chassis inventory" for: CSS 11501 CSS 11503 CSS 11506 Can anyone help? Thanks in advance. Mike
-
Hello Gurus, Can you please help me with following issue-- I have created a secured web service's client from netbeans 6.8.Then I made a jar file of it.Then I have integrated that jar in my ADF application's viewcontroller project .I have used the ja