Subquery returns more than one value subquery returns more than one value......
UPDATE CORPORATECARD_TST SET (CORPORATECARD_TST. USERNAME, CORPORATECARD_TST. CREDITCARDIDCD, CORPORATECARD_TST. DATEINSERTED, CORPORATECARD_TST. DATEUPDATED, CORPORATECARD_TST. CUSTOMERNAME, CORPORATECARD_TST. FORMOFPAYCCNUMFIRSTSIX, CORPORATECARD_TST. FORMOFPAYCCNUMLASTFOUR) = (select distinct CORPORATECARD_SQL. USERNAME, CORPORATECARD_SQL. CREDITCARDIDCD, CORPORATECARD_SQL. DATEINSERTED, CORPORATECARD_SQL. DATEUPDATED, CORPORATECARD_SQL. CUSTOMERNAME, CORPORATECARD_SQL. FORMOFPAYCCNUMFIRSTSIX, CORPORATECARD_SQL. Join FORMOFPAYCCNUMLASTFOUR internal CORPORATECARD_SQL CORPORATECARD_TST on CORPORATECARD_SQL. CORPORATECARDID = CORPORATECARD_TST. CORPORATECARDID);
CREATE TABLE CORPORATECARD_TST
(
CORPORATECARDID NUMBER(*, 0) NOT NULL
VARCHAR2 (50 BYTE) USER NAME NOT NULL
CREDITCARDIDCD CHAR (2 BYTES) NOT NULL
DATEINSERTED DATE NOT NULL
DATEUPDATED DATE NOT NULL
VARCHAR2 (255 BYTE) CUSTOMERNAME
FORMOFPAYCCNUMFIRSTSIX CHAR (6 BYTES)
FORMOFPAYCCNUMLASTFOUR CHAR (4 BYTES)
)
CREATE TABLE CORPORATECARD_SQL
(
CORPORATECARDID NUMBER(*, 0) NOT NULL
VARCHAR2 (50 BYTE) USER NAME NOT NULL
CREDITCARDIDCD CHAR (2 BYTES) NOT NULL
DATEINSERTED DATE NOT NULL
DATEUPDATED DATE NOT NULL
VARCHAR2 (255 BYTE) CUSTOMERNAME
FORMOFPAYCCNUMFIRSTSIX CHAR (6 BYTES)
FORMOFPAYCCNUMLASTFOUR CHAR (4 BYTES)
)
Here is the data in the table _TST
2044 TestUser AX 2 February 12 February 2, 12 TestClient 123456 9876
2007 TestUser AX 30 January 12 January 30, 12 TestClient 123456 9876
2004 TestUser AX 30 January 12 January 30, 12 TestClient 123456 9876
2010 TestUser AX 31 January 12 January 31, 12 TestClient 123456 9876
TestUser AX 19-SEVEN 6. - 11 19 - SEPT. - 11 123456 9876 TestClient
2045 TestUser AX 2 February 12 February 2, 12 TestClient 123456 9876
2020 TestUser AX 1 February 12 February 1, 12 TestClient 123456 9876
2011 TestUser AX 31 January 12 January 31, 12 TestClient 123456 9876
2012 TestUser AX 31 January 12 January 31, 12 TestClient 123456 9876
2046 TestUser AX 2 February 12 February 2, 12 TestClient 123456 9876
2138 TestUser AX 26 July 12 July 26, 12 TestClient 123456 9876
Here is the data in the table _SQL
2009 NEW TestUser DS 31 January 12 January 31, 12 NEW TestClient 999999 0
2044 NEW TestUser VI 2 February 12 February 2, 12 NEW TestClient 999999 0
2007 NEW TestUser DC 30 January 12 January 30, 12 NEW TestClient 999999 0
2004 NEW TestUser MC 30 January 12 January 30, 12 NEW TestClient 999999 0
2010 NEW TestUser VI 31 January 12 January 31, 12 NEW TestClient 999999 0
6 NEW TestUser AX 19-SEVEN. - 11 19 - SEPT. - 11 NEW TestClient 999999 0
2045 NEW TestUser VI 2 February 12 February 2, 12 NEW TestClient 999999 0
2020 NEW TestUser DS 1 February 12 February 1, 12 NEW TestClient 999999 0
2011 NEW TestUser AX 31 January 12 January 31, 12 NEW TestClient 999999 0
2012 NEW TestUser AX 31 January 12 January 31, 12 NEW TestClient 999999 0
2046 NEW TestUser VI 2 February 12 February 2, 12 NEW TestClient 999999 0
2138 NEW TestUser AX 26 July 12 July 26, 12 NEW TestClient 999999 0
Here's the MERGE statement...
MERGE INTO CORPORATECARD_TST D
USING
(
Select distinct
CORPORATECARD_SQL. CORPORATECARDID
CORPORATECARD_SQL. USERNAME
CORPORATECARD_SQL. CREDITCARDIDCD
CORPORATECARD_SQL. DATEINSERTED
CORPORATECARD_SQL. DATEUPDATED
CORPORATECARD_SQL. CUSTOMERNAME
CORPORATECARD_SQL. FORMOFPAYCCNUMFIRSTSIX
CORPORATECARD_SQL. FORMOFPAYCCNUMLASTFOUR
Of
CORPORATECARD_SQL
) S
WE
(
D.CORPORATECARDID = S.CORPORATECARDID
)
WHEN MATCHED, THEN UPDATE GAME
S.USERNAME = D.USERNAME
D.CREDITCARDIDCD = S.CREDITCARDIDCD,
D.DATEINSERTED = S.DATEINSERTED,
D.DATEUPDATED = S.DATEUPDATED,
D.CLIENTNAME = S.CLIENTNAME,
D.FORMOFPAYCCNUMFIRSTSIX = S.FORMOFPAYCCNUMFIRSTSIX,
D.FORMOFPAYCCNUMLASTFOUR = S.FORMOFPAYCCNUMLASTFOUR,
WHEN NOT MATCHED THEN INSERT
(
D.CORPORATECARDID
D.USERNAME
D.CREDITCARDIDCD
D.DATEINSERTED
D.DATEUPDATED
D.CLIENTNAME
D.FORMOFPAYCCNUMFIRSTSIX
D.FORMOFPAYCCNUMLASTFOUR
)
VALUES
(
S.CORPORATECARDID
S.USERNAME
S.CREDITCARDIDCD
S.DATEINSERTED
S.DATEUPDATED
S.CLIENTNAME
S.FORMOFPAYCCNUMFIRSTSIX
S.FORMOFPAYCCNUMLASTFOUR
)
;
The desired output would be for the _TST and the _SQL to have the same data as the _SQL as below...
2009 NEW TestUser DS 31 January 12 January 31, 12 NEW TestClient 999999 0
2044 NEW TestUser VI 2 February 12 February 2, 12 NEW TestClient 999999 0
2007 NEW TestUser DC 30 January 12 January 30, 12 NEW TestClient 999999 0
2004 NEW TestUser MC 30 January 12 January 30, 12 NEW TestClient 999999 0
2010 NEW TestUser VI 31 January 12 January 31, 12 NEW TestClient 999999 0
6 NEW TestUser AX 19-SEVEN. - 11 19 - SEPT. - 11 NEW TestClient 999999 0
2045 NEW TestUser VI 2 February 12 February 2, 12 NEW TestClient 999999 0
2020 NEW TestUser DS 1 February 12 February 1, 12 NEW TestClient 999999 0
2011 NEW TestUser AX 31 January 12 January 31, 12 NEW TestClient 999999 0
2012 NEW TestUser AX 31 January 12 January 31, 12 NEW TestClient 999999 0
2046 NEW TestUser VI 2 February 12 February 2, 12 NEW TestClient 999999 0
2138 NEW TestUser AX 26 July 12 July 26, 12 NEW TestClient 999999 0
However, after I compile and run the Sp that has the MERGER, data still looks like this...
Here is the data in the table _TST
2044 TestUser AX 2 February 12 February 2, 12 TestClient 123456 9876
2007 TestUser AX 30 January 12 January 30, 12 TestClient 123456 9876
2004 TestUser AX 30 January 12 January 30, 12 TestClient 123456 9876
2010 TestUser AX 31 January 12 January 31, 12 TestClient 123456 9876
TestUser AX 19-SEVEN 6. - 11 19 - SEPT. - 11 123456 9876 TestClient
2045 TestUser AX 2 February 12 February 2, 12 TestClient 123456 9876
2020 TestUser AX 1 February 12 February 1, 12 TestClient 123456 9876
2011 TestUser AX 31 January 12 January 31, 12 TestClient 123456 9876
2012 TestUser AX 31 January 12 January 31, 12 TestClient 123456 9876
2046 TestUser AX 2 February 12 February 2, 12 TestClient 123456 9876
2138 TestUser AX 26 July 12 July 26, 12 TestClient 123456 9876
Here is the data in the table _SQL
2009 NEW TestUser DS 31 January 12 January 31, 12 NEW TestClient 999999 0
2044 NEW TestUser VI 2 February 12 February 2, 12 NEW TestClient 999999 0
2007 NEW TestUser DC 30 January 12 January 30, 12 NEW TestClient 999999 0
2004 NEW TestUser MC 30 January 12 January 30, 12 NEW TestClient 999999 0
2010 NEW TestUser VI 31 January 12 January 31, 12 NEW TestClient 999999 0
6 NEW TestUser AX 19-SEVEN. - 11 19 - SEPT. - 11 NEW TestClient 999999 0
2045 NEW TestUser VI 2 February 12 February 2, 12 NEW TestClient 999999 0
2020 NEW TestUser DS 1 February 12 February 1, 12 NEW TestClient 999999 0
2011 NEW TestUser AX 31 January 12 January 31, 12 NEW TestClient 999999 0
2012 NEW TestUser AX 31 January 12 January 31, 12 NEW TestClient 999999 0
2046 NEW TestUser VI 2 February 12 February 2, 12 NEW TestClient 999999 0
2138 NEW TestUser AX 26 July 12 July 26, 12 NEW TestClient 999999 0
Tags: Database
Similar Questions
-
Single - row subquery returns more than one line.
Hi Experts
I am faced with error
ORA-01427: single - row subquery returns more than one line.
MyQuery is:
select TO_CHAR(T.MR_REG_DATE,'DD') "DATE" ,CASE WHEN trunc((MONTHS_BETWEEN(T.MR_REG_DATE,T.MR_DOB))) between 0 and 1 THEN ' 01'||' - ('||'0 - 1 Month)' WHEN trunc((MONTHS_BETWEEN(T.MR_REG_DATE,T.MR_DOB))) BETWEEN 2 AND 12 THEN ' 02'||' - ('||'2 - 12 Months)' WHEN trunc((MONTHS_BETWEEN(T.MR_REG_DATE,T.MR_DOB))) BETWEEN 13 AND 60 THEN ' 03'||' - ('||'1 - 5 Years)' WHEN trunc((MONTHS_BETWEEN(T.MR_REG_DATE,T.MR_DOB))) BETWEEN 61 AND 120 THEN ' 04'||' - ('||'5 - 10 Years)' WHEN trunc((MONTHS_BETWEEN(T.MR_REG_DATE,T.MR_DOB))) > 120 then ' 05'||' - ('||'> 10 Years)' END age ,count(T.Mr_Code) No_of_Patient ,( SELECT count(x.mr_code) mr_code FROM HMIS_MRINFO X where X.mr_reg_date between &FRM_DATE AND &TO_DATE and X.mr_code NOT in (select Y.mr_code from hmis_pat_add_dis_detail Y WHERE Y.mr_reg_date between &FRM_DATE AND &TO_DATE ) GROUP BY CASE WHEN trunc((MONTHS_BETWEEN(X.MR_REG_DATE,X.MR_DOB))) between 0 and 1 THEN ' 01'||' - ('||'0 - 1 Month)' WHEN trunc((MONTHS_BETWEEN(X.MR_REG_DATE,X.MR_DOB))) BETWEEN 2 AND 12 THEN ' 02'||' - ('||'2 - 12 Months)' WHEN trunc((MONTHS_BETWEEN(X.MR_REG_DATE,X.MR_DOB))) BETWEEN 13 AND 60 THEN ' 03'||' - ('||'1 - 5 Years)' WHEN trunc((MONTHS_BETWEEN(X.MR_REG_DATE,X.MR_DOB))) BETWEEN 61 AND 120 THEN ' 04'||' - ('||'5 - 10 Years)' WHEN trunc((MONTHS_BETWEEN(X.MR_REG_DATE,X.MR_DOB))) > 120 then ' 05'||' - ('||'> 10 Years)' END ) Missing_MR from hmis_mrinfo T,hmis_pat_add_dis_detail M where T.mr_code = M.mr_code(+) and T.mr_reg_date between &FRM_DATE AND &TO_DATE &AGE_GRP GROUP BY T.MR_REG_DATE ,CASE WHEN trunc((MONTHS_BETWEEN(T.MR_REG_DATE,T.MR_DOB))) between 0 and 1 THEN ' 01'||' - ('||'0 - 1 Month)' WHEN trunc((MONTHS_BETWEEN(T.MR_REG_DATE,T.MR_DOB))) BETWEEN 2 AND 12 THEN ' 02'||' - ('||'2 - 12 Months)' WHEN trunc((MONTHS_BETWEEN(T.MR_REG_DATE,T.MR_DOB))) BETWEEN 13 AND 60 THEN ' 03'||' - ('||'1 - 5 Years)' WHEN trunc((MONTHS_BETWEEN(T.MR_REG_DATE,T.MR_DOB))) BETWEEN 61 AND 120 THEN ' 04'||' - ('||'5 - 10 Years)' WHEN trunc((MONTHS_BETWEEN(T.MR_REG_DATE,T.MR_DOB))) > 120 then ' 05'||' - ('||'> 10 Years)' END ORDER BY T.MR_REG_DATE;
Please give some advice / solution.
I think this might do it for you
Select
TO_CHAR (T.MR_REG_DATE, 'DD') "DATE."
CASE
WHEN trunc ((MONTHS_BETWEEN (T.MR_REG_DATE, T.MR_DOB))) between 0 and 1 THEN ' 01' |'. - ('||' 0-1 month)"
WHEN trunc ((MONTHS_BETWEEN (T.MR_REG_DATE, T.MR_DOB))) BETWEEN 2 AND 12 THEN ' 02' |'. - ('||' 2-12 months)"
WHEN trunc ((MONTHS_BETWEEN (T.MR_REG_DATE, T.MR_DOB))) BETWEEN 13 AND 60 THEN ' 03' |'. - ('||' 1-5 years)"
WHEN trunc ((MONTHS_BETWEEN (T.MR_REG_DATE, T.MR_DOB))) BETWEEN 61 AND 120 THEN ' 04' |'. - ('||' 5-10 years)'
WHEN trunc ((MONTHS_BETWEEN (T.MR_REG_DATE, T.MR_DOB))) > 120 then ' 05' |'. ' - ('| ' > 10 years).
Age of the END
count (T.Mr_Code) No_of_Patient
, count (case when t.mr_code NOT in (select Y.mr_code from hmis_pat_add_dis_detail Y))
WHERE Y.mr_reg_date between & FRM_DATE AND & TO_DATE)
then t.mr_code
(end) Missing_MR
of hmis_mrinfo T, hmis_pat_add_dis_detail M
where T.mr_code = M.mr_code (+)
and between T.mr_reg_date & FRM_DATE AND & TO_DATE
& AGE_GRP
T.MR_REG_DATE GROUP
CASE
WHEN trunc ((MONTHS_BETWEEN (T.MR_REG_DATE, T.MR_DOB))) between 0 and 1 THEN ' 01' |'. - ('||' 0-1 month)"
WHEN trunc ((MONTHS_BETWEEN (T.MR_REG_DATE, T.MR_DOB))) BETWEEN 2 AND 12 THEN ' 02' |'. - ('||' 2-12 months)"
WHEN trunc ((MONTHS_BETWEEN (T.MR_REG_DATE, T.MR_DOB))) BETWEEN 13 AND 60 THEN ' 03' |'. - ('||' 1-5 years)"
WHEN trunc ((MONTHS_BETWEEN (T.MR_REG_DATE, T.MR_DOB))) BETWEEN 61 AND 120 THEN ' 04' |'. - ('||' 5-10 years)'
WHEN trunc ((MONTHS_BETWEEN (T.MR_REG_DATE, T.MR_DOB))) > 120 then ' 05' |'. ' - ('| ' > 10 years).
END
ORDER BY T.MR_REG_DATE;
-
DECODE does not work in the WHERE clause when subquery returns more than one line
Hi gurus,
I want to write a query against the table CCENTERS (Script given below) and wait for the following result:
1. in the transition from a value of 0 for the ID, it returns all the rows in the table.
2. in the passage of one value other than 0, it returns the row corresponding to the given value and all its records of the child.
CCENTER has parent-child relationship in the column ID and the BASE. I use a query with the DECODE function. but the function in the WHERE clause is not capable of managing the subquery with multiple lines of DECODE.
*************************************************
VARIABLE ParaCCenter NUMBER
BEGIN
: paraccenter: = 0;
END;
/
CREATE TABLE ccenters
(id NUMBER,
name VARCHAR2 (20).
number base);
INSERT INTO ccenters VALUES(1,'NUST',null);
INSERT INTO ccenters VALUES(2,'SEECS',1);
INSERT INTO ccenters VALUES(3,'NBS',1);
commit;
SELECT * from ccenters
WHERE id IN DECODE(:ParaCCenter, 0, id,)
(SELECT id FROM ccenters
START WITH basic =: ParaCCenter
ID of CONNECTION BY PRIOR = base
UNION
SELECT: ParaCCenter OF double
)
)
/
BEGIN
: paraCCenter: = 1;
END;
/
SELECT * from ccenters
WHERE id IN DECODE(:ParaCCenter, 0, id,)
(SELECT id FROM ccenters
START WITH basic =: ParaCCenter
ID of CONNECTION BY PRIOR = base
UNION
SELECT: ParaCCenter double))
/
The result is
(SELECT id FROM ccenters
*
ERROR at line 3:
ORA-01427: einreihig subquery returns multiple rows
How this query can be rewritten for the given feature. Any response will be appreciated.
Thank youTry something like this:
SELECT * FROM ccenters WHERE :ParaCCenter = 0 OR id in (SELECT id FROM ccenters START WITH base=:ParaCCenter CONNECT BY PRIOR id = base UNION SELECT :ParaCCenter FROM dual )
-
Einreihig subquery returns more than one query
Hello
I get the following error: einreihig subquery returns more than one request. I don't know how I should debug this application. As far as I know, subqueries can return only 1 row...: S
I've only Oracle SQL Developer to run/test of my queries. I can run the query with ROWNUM < 5000, which gives no error. If I run with ROWNUM > 5000 and ROWNUM < 6000 then the error pops up...
This is the query:
Published by: layout of the code user574699 on November 17, 2008 02:10with DATES as (select (select min(REC_DATE) from STOCK) as FROM_DT, (select max(CHANGE_DATE) from STOCK_ADJUST) as TO_DT from DUAL), MONTHS as (select add_months(trunc(FROM_DT,'MM'),ROWNUM-1) as DT from DATES connect by ROWNUM <= months_between(TO_DT, FROM_DT)+1), CALCULATIONS as (select PNM.PNM_AUTO_KEY PNM_KEY, MONTHS.DT DT, NVL((select sum(stm.qty_rec) from stock stm WHERE STM.REC_DATE < MONTHS.DT AND STM.PNM_AUTO_KEY = PNM.PNM_AUTO_KEY GROUP BY pnm_auto_key),0) INCOMING, NVL((select sum(saj.qty_adj) from stock_adjust saj inner join stock stm on saj.stm_auto_key = stm.stm_auto_key inner join parts_master pnm on stm.pnm_auto_key = pnm.pnm_auto_key where SAJ.CHANGE_DATE < MONTHS.DT AND STM.PNM_AUTO_KEY = PNM.PNM_AUTO_KEY group by pnm_auto_key),0) OUTGOING from MONTHS, PARTS_MASTER PNM) SELECT ROWNUM, CALCULATIONS.PNM_KEY PNM_AUTO_KEY, CALCULATIONS.DT COUNT_DATE,CALCULATIONS.INCOMING QTY_RECEIVED, CALCULATIONS.OUTGOING QTY_USED, (CALCULATIONS.INCOMING + CALCULATIONS.OUTGOING) QTY_BALANCE FROM CALCULATIONS;
the problem is that you use the same alias in your view online as well as in your main query in the second statement-nvl...
HTH
-
"ORA-01427: einreihig subquery returns more than one line.
Hi all
I have a SQL query where I need a subquery for certain fields (like fields are optional), and the thing is some of the subqueries are works well, but when I use some, it gives me an error * "ORA-01427: einreihig subquery returns more rows" *, so I looked to the top of the internet and found if I give *' and rownum = 1' * in the subquery ". It eliminates the error and there certainly, but the thing is I have test the XML data. I have two addresses that should appear on the report and both follow the same path, but one is required optional and another so I put the option in the subquery, but in the XML data, I see that both addresses are the same, but they need to be different, because the status of the relationship with that I question is different. I ALSO POST MY SQL so that if anyone of you has an idea can help out me. Once more, the sql, I put here has the SQL subqueries with ' and rownum = 1', which gives me bad output
Select S_FN_INCEXP_CON. RELATION_TYPE_CD as RELATION_TYPE_CD,
S_ORDER. ORDER_NUM as ORDER_NUM,
S_ORDER. FRGHT_AMT as FRGHT_AMT,
S_ORDER. ORDER_DT as ORDER_DT,
S_ORDER. CARRIER_CD as CARRIER_CD,
S_ORDER. CARRIER_PRIO_CD as CARRIER_PRIO_CD,
S_ORDER. ACCNT_ORDER_NUM as ACCNT_ORDER_NUM,
S_CONTACT. FST_NAME as FST_NAME,
S_CONTACT. Last_name like LAST_NAME,
S_ADDR_PER. ADDR_NAME as ADDR_NAME-> it's the address required
S_ADDR_PER. POSTAL CODE such as POSTAL code,
S_CON_ADDR. ADDR_MAIL_CD as ADDR_MAIL_CD,
S_ADDR_PER. EMAIL_ADDR as EMAIL_ADDR,
S_ADDR_PER. PH_NUM as PH_NUM,
S_SRC_PAYMENT. PAYMENT_NUM as PAYMENT_NUM,
S_ORDER. STATUS_CD as STATUS_CD,
(select S_FN_INCEXP_CON_1.RELATION_TYPE_CD
of SIEBEL. S_CONTACT S_CONTACT_1,
SIEBEL. S_FN_INCEXP_CON S_FN_INCEXP_CON_1
where S_ORDER. ROW_ID = S_FN_INCEXP_CON_1.FN_INCM_EXP_ID
and S_FN_INCEXP_CON_1.CONTACT_ID = S_CONTACT_1.ROW_ID
and S_FN_INCEXP_CON_1.RELATION_TYPE_CD! = ALL ('Donor', 'Notified Party', ' in memory of ', ' in honor of ')) RELATION_TYPE_CD_1
, (select S_CONTACT_1.FST_NAME |') '|| S_CONTACT_1.LAST_NAME
of SIEBEL. S_CONTACT S_CONTACT_1,
SIEBEL. S_FN_INCEXP_CON S_FN_INCEXP_CON_1
where S_ORDER. ROW_ID = S_FN_INCEXP_CON_1.FN_INCM_EXP_ID
and S_FN_INCEXP_CON_1.CONTACT_ID = S_CONTACT_1.ROW_ID
and S_FN_INCEXP_CON_1.RELATION_TYPE_CD! = ALL ('Donor', 'Notified Party', ' in memory of ', ' in honor of ')) NAME.
(select S_ORDER_TYPE.NAME
of SIEBEL. S_ORDER_TYPE S_ORDER_TYPE
where S_ORDER. ORDER_TYPE_ID = S_ORDER_TYPE. ROW_ID
and S_ORDER_TYPE.NAME = 'Général'), GENERAL
(select S_ORDER_TYPE.NAME
of SIEBEL. S_ORDER_TYPE S_ORDER_TYPE
where S_ORDER. ORDER_TYPE_ID = S_ORDER_TYPE. ROW_ID
and S_ORDER_TYPE.NAME = 'Memory') MEMORY,
(select S_ORDER_TYPE.NAME
of SIEBEL. S_ORDER_TYPE S_ORDER_TYPE
where S_ORDER. ORDER_TYPE_ID = S_ORDER_TYPE. ROW_ID
and S_ORDER_TYPE.NAME = 'Honour') HONOR,.
(select S_FN_INCEXP_CON_1.RELATION_TYPE_CD
of SIEBEL. S_CONTACT S_CONTACT_1,
SIEBEL. S_FN_INCEXP_CON S_FN_INCEXP_CON_1
where S_ORDER. ROW_ID = S_FN_INCEXP_CON_1.FN_INCM_EXP_ID
and S_FN_INCEXP_CON_1.CONTACT_ID = S_CONTACT_1.ROW_ID
and S_FN_INCEXP_CON_1.RELATION_TYPE_CD = ' in memory of ') R1,.
(select S_FN_INCEXP_CON_1.RELATION_TYPE_CD
of SIEBEL. S_CONTACT S_CONTACT_1,
SIEBEL. S_FN_INCEXP_CON S_FN_INCEXP_CON_1
where S_ORDER. ROW_ID = S_FN_INCEXP_CON_1.FN_INCM_EXP_ID
and S_FN_INCEXP_CON_1.CONTACT_ID = S_CONTACT_1.ROW_ID
and S_FN_INCEXP_CON_1.RELATION_TYPE_CD = ' in honor of ") R2,.
(select S_FN_INCEXP_CON_1.RELATION_TYPE_CD
of SIEBEL. S_CONTACT S_CONTACT_1,
SIEBEL. S_FN_INCEXP_CON S_FN_INCEXP_CON_1
where S_ORDER. ROW_ID = S_FN_INCEXP_CON_1.FN_INCM_EXP_ID
and S_FN_INCEXP_CON_1.CONTACT_ID = S_CONTACT_1.ROW_ID
and S_FN_INCEXP_CON_1.RELATION_TYPE_CD = 'notified Party') R3.
(select S_ADDR_PER. ADDR_NAME | ',' | S_ADDR_PER. Zip code
of SIEBEL. S_ADDR_PER S_ADDR_PER,
SIEBEL. S_CON_ADDR S_CON_ADDR,
SIEBEL. S_CONTACT S_CONTACT_1,
SIEBEL. S_FN_INCEXP_CON S_FN_INCEXP_CON_1
where S_ORDER. ROW_ID = S_FN_INCEXP_CON_1.FN_INCM_EXP_ID
and S_FN_INCEXP_CON_1.CONTACT_ID = S_CONTACT_1.ROW_ID
and S_CONTACT. ROW_ID = S_CON_ADDR. CONTACT_ID
and S_CON_ADDR. ADDR_PER_ID = S_ADDR_PER. ROW_ID
and rownum = 1
and S_FN_INCEXP_CON_1.RELATION_TYPE_CD IN 'Notified Party') NP_ADDR-> it's the optional address
(select S_PARTY_REL. REL_TYPE_CD
of SIEBEL. S_PARTY_REL S_PARTY_REL,
SIEBEL. S_CONTACT S_CONTACT_1,
SIEBEL. S_FN_INCEXP_CON S_FN_INCEXP_CON_1
where S_ORDER. ROW_ID = S_FN_INCEXP_CON_1.FN_INCM_EXP_ID
and S_FN_INCEXP_CON_1.CONTACT_ID = S_CONTACT_1.ROW_ID
and S_PARTY_REL. REL_PARTY_ID = S_CONTACT_1.ROW_ID
and S_FN_INCEXP_CON_1.RELATION_TYPE_CD = ' in memory of ') RLNSHIP
of SIEBEL. S_CONTACT S_CONTACT,
SIEBEL. S_FN_INCEXP_CON S_FN_INCEXP_CON,
SIEBEL. S_ORDER S_ORDER,
SIEBEL. S_ADDR_PER S_ADDR_PER,
SIEBEL. S_CON_ADDR S_CON_ADDR,
SIEBEL. S_SRC_PAYMENT S_SRC_PAYMENT
where S_ORDER. ROW_ID = S_FN_INCEXP_CON. FN_INCM_EXP_ID
and S_FN_INCEXP_CON. CONTACT_ID = S_CONTACT. ROW_ID
and S_CONTACT. ROW_ID = S_CON_ADDR. CONTACT_ID
and S_CON_ADDR. ADDR_PER_ID = S_ADDR_PER. ROW_ID
and S_FN_INCEXP_CON. RELATION_TYPE_CD = 'donor '.
and S_SRC_PAYMENT. ORDER_ID = S_ORDER. ROW_IDUse
' and S_CONTACT_1.ROW_ID = S_CON_ADDR. CONTACT_ID'
your 3rd condition in where clause.So it would be to get the address of the 'notified part' information instead of the donor
-
ORA-01427: row subquery returns more than one line
Hello
I get the above error but I'm not sure how
its on the line in bold (it says line 16)
Thanks in advance
(s_entry IN varchar2)
return ind_field_value_table
IS
found_count number (10);
T_RETURN ind_field_value_table: = ind_field_value_table();
Start
for news (select master, table_name, column_name
from all_tab_columns
where <>'SYS' owner and owner <>'SYSTEM '.
and (Data_type = 'CHAR' OR Data_type = 'NCHAR' OR Data_type = "NVARCHAR2" OR Data_type = 'VARCHAR2')
Order by owner, table_name, column_name)
loop
immediate execution
' *'select count (1) of "| cur. Owner | '.' || cur.table_name | 'where ' | cur.column_name | ' = ' || '''' || s_entry | ''' '*
in found_count;
found_count: = nvl (found_count, 0);
If found_count <>0 then
T_RETURN.extend;
T_RETURN (T_RETURN. (Count): = ind_field_value (cur.owner, cur.table_name, cur.column_name);
end if;
end loop;
Return t_return;
end;Create an exception handler to dig deeper into the analysis and may use a string instead of direct statement on run immediately, it is often easier for debugging of object, for example:
... begin stmt:='select count(*) .....'; execute immediate stmt into your_count; exception when others then dbms_output.put_line(sqlerrm||' '||stmt); end; ...
Nicolas.
-
Hi Jeff,
I use the ai2 since September 13 and I got this error when I run several reports from the RAC (2 knots) databases.
For ex. in the DBA Panel, according to the Performance option, when I try to launch ASHES for las 5 minutes, the ORA-01427 out immediately.
I want just to be sure you're already aware of this problem and taken into account for the next version.
Thanks in advance,
Andraly Ng
EA3 just came out a few hours ago - have a go at it and let us know what you think!
-
error:-row subquery returns more than one line, pls help
SELECT dsg_code, dsg_name, dsg_grade FROM designation_master WHERE dsg_orgn =:parameter.p_orgn and dsg_ctry =:parameter.p_ctry and dsg_loc =: parameter.p_loc and dsg_oru =: parameter.p_oru
and dsg_code <>: emp_desig and dsg_grade in (decode(:radio_group,)
1, (SELECT grd_code FROM grade_master WHERE grd_osm_code in (Select distinct grd_osm_code FROM grade_master WHERE grd_orgn =:parameter.p_orgn and grd_ctry =:parameter.p_ctry and grd_loc =: parameter.p_loc and grd_oru =: parameter.p_oru and grd_code =: emp_grade)).
2, (SELECT grd_code FROM grade_master WHERE grd_osm_code > all (Select distinct grd_osm_code FROM grade_master WHERE the grd_orgn =:parameter.p_orgn and grd_ctry =:parameter.p_ctry and grd_loc =: parameter.p_loc and grd_oru =: parameter.p_oru and grd_code =: emp_grade)).
3, (SELECT grd_code FROM grade_master WHERE grd_osm_code < all (Select distinct grd_osm_code FROM grade_master WHERE the grd_orgn =:parameter.p_orgn and grd_ctry =:parameter.p_ctry and grd_loc =: parameter.p_loc and grd_oru =: parameter.p_oru and grd_code =: emp_grade)))Try something like this:
SELECT dsg_code,dsg_name,dsg_grade FROM designation_master WHERE dsg_orgn=:parameter.p_orgn AND dsg_ctry=:parameter.p_ctry AND dsg_loc =:parameter.p_loc AND dsg_oru = :parameter.p_oru AND dsg_code!=:emp_desig AND ( ( :radio_group=1 AND dsg_grade in (SELECT grd_code FROM grade_master WHERE grd_osm_code in (Select distinct grd_osm_code FROM grade_master WHERE grd_orgn=:parameter.p_orgn and grd_ctry=:parameter.p_ctry And grd_loc =:parameter.p_loc And grd_oru = :parameter.p_oru and grd_code =:emp_grade ) ) ) OR ( :radio_group=2 AND dsg_grade in (SELECT grd_code FROM grade_master WHERE grd_osm_code >any (Select distinct grd_osm_code FROM grade_master WHERE grd_orgn=:parameter.p_orgn and grd_ctry=:parameter.p_ctry And grd_loc =:parameter.p_loc And grd_oru = :parameter.p_oru and grd_code =:emp_grade ) ) ) OR ( :radio_group=3 AND dsg_grade in (SELECT grd_code FROM grade_master WHERE grd_osm_code
not tested
-
How to have a variable the function "return" have more than one value
@using the Sub function how can user_id accepts the values 0 and 6?
create or replace function xxactive_user_test)
p_schema in varchar2,
p_object in varchar2)
return varchar2
as
Start
return 'user_id = 0';
end;
/
Post edited by: 880492
The question or needs is not clear, to me at least.
> How user_id can take the values 0 and 6
How the function is used.
You mean like this:
return 'user_id IN (0,6)';
-
single row subquery returns more than 1 row
UPDATE Rftm_Pidwise_Revenue_Dtls
SET cost_prior_qtr = (select cost_forecast_end
of rftm_time_entry_calc
where rftm_time_entry_calc.pid = Rftm_Pidwise_Revenue_Dtls.pid
AND rftm_time_entry_calc.ideal_ref_no = Rftm_Pidwise_Revenue_Dtls.ideal_ref_no
)
WHERE ideal_ref_no = '140014';
Hi all
I have a requirement where I have to update a table (Rftm_Pidwise_Revenue_Dtls) and the value of the column 'cost' to the ' 140014 ideal_ref_no'. for this issue, there are several records in the tables that I use in my application. I want to match the corresponding 'pid' and update the cost for each "pid".
Please help me with a correct query.
Kind regards
BelinTry once...(untested) MERGE INTO Rftm_Pidwise_Revenue_Dtls TRG using ( select DISTINCT A.cost_forecast_end cost_forecast_end,B.ROWID RI from rftm_time_entry_calc A,Rftm_Pidwise_Revenue_Dtls B where A.pid=B.pid AND A.ideal_ref_no=B.ideal_ref_no AND B.ideal_ref_no='140014'; ) SRC on (TRG.ROWID=SRC.RI) WHEN MATCHED THEN UPDATE SET TRG.cost_prior_qtr =SRC.cost_forecast_end;
-
single-line subquery returns moret one line han
UPDATE T74
SET LORRYOWNERNAME = 'BELLA. "
OWNERFATHERNAME = "GHANIMIYA"
AND
(SELECT T74 INVOICEDATE, T74A WHERE T74.) REFERENCENO = T74A. REFERENCENO AND T74. "LORRYNO ="KA05AA4916"AND INVOICEDATE > = February 25, 2011")= February 25, 2011 "
my inner query returns 5 rows ihave to update only the data that are greater than 25 February 2011"
not below when I use > = any it updates all rows, if I removed everything he is in error:
single-line subquery returns moret one line han
could you please correct the query
Published by: 848525 on Sep 7, 2011 12:18 AMTry
UPDATE T74 SET LORRYOWNERNAME='BASHA', OWNERFATHERNAME='GHANIMIYA', PANNO='AGNPD4113G' WHERE LORRYNO='KA05AA4916' AND exists (SELECT INVOICEDATE FROM T74A WHERE T74.REFERENCENO=T74A.REFERENCENO AND INVOICEDATE>='25-FEB-2011')
do not duplicate the post please
Published by: Alexandr Sep 6, 2011 23:52
-
Subquery returns the same value but no returnet lines
HY all
First of all excuse me for my English. I know that is very bad.
I have a very annoying problem...
I habe a query like this
Select the car of cars where car_color = (select color color where car_id = '5452')
My real Qery is mor complicated, but this is how it works.
Now the problem:
If I run the first query select car of cars where car_color = 'black' the query returns a value.
If I run the subquery *(select color from Colors where car_id ='5452') * the subquery returns a value (black)
If I run the query and subquery select car of cars where car_color = (select color color where car_id = '5452')
I get no value :(
How this bee? If I take the (black) result of the subquery, and paste of STIs in the first request, then I get a value.
But if I use the two querys it works.
Thank you for your support
Welcomes Burillouser13568585 wrote:
I can see that the results are not the same, but how can it happen?
Without your thing, I'll never be able to see the problem. Toad is really stupid as I think?It has nothing to do with the toad. You will get the same results in SQL * more. Most of the tools on the client side display the nonprinting characters such as spaces. And in your case, string returned by the subquery has had new line at the end. Anyway, the other way to understand would compare dumps of returned strings:
select DUMP(LTRIM(RTRIM(rem.PSTREM_KURZ_BEZ))) from p_pveps_episode eps, p_pvrep_re rep, p_strem_rechempf rem WHERE eps.allmnd_mandant='Test' and eps.ppveps_aufnr='101224' and eps.allmnd_mandant=rep.allmnd_mandant and eps.ppveps_epsnr=rep.ppveps_epsnr and rep.pstrem_ident=rem.pstrem_ident -- {and ltrim(rtrim(rem.PSTREM_KURZ_BEZ)) =} quotet to show result
SY.
-
subquery returns no row in the main query, but hard returns the value of the master query
Oracle 11g, Solaris SPARC 64-bit:
This is the master query: its not to return all the lines
Select count (*) in the sadmin.usr_mods where to_char (ts_id) in ((select to_char (rtrim (ltrim(TS_MODULES,','), ',')) in the sadmin.usr_rfc where TS_KINTANA_PACKAGE_NUMBER = '123' and ts_projectid = 3));
COUNT (*)
----------
0
But wherever if I use subquery only returns he lines:
SQL > select rtrim (ltrim(TS_MODULES,','), ',') from the sadmin.usr_rfc where TS_KINTANA_PACKAGE_NUMBER = '123' and ts_projectid = 3;
RTRIM (LTRIM(TS_MODULES,','), ',')
--------------------------------------------------------------------------------
49,54
If I use these values as hardcoded to a select master it will return 2 rows:
SQL > select count (*) in the sadmin.usr_mods where to_char (ts_id) in ('49 ', ' 54');
COUNT (*)
----------
2
TS_MODULES datatype is CLOB
TS_ID datatype is set to number
Help, please
with
usr_rfc as
(select 3 ts_projectid, 123 ts_kintana_package_number, to_clob(',49,54,') ts_modules
of the double
),
usr_mods as
(select ts_id 49 Union double all the)
Select 50 in all double union
Select double 54
)
Select count (*)
of usr_mods
where to_char (ts_id) in (select regexp_substr (to_char (rtrim (ltrim(TS_MODULES,','), ',')),'[^,] +', 1, level))
of usr_rfc
where TS_KINTANA_PACKAGE_NUMBER = '123'
and ts_projectid = 3
connect by level<= regexp_count(to_char(rtrim(ltrim(ts_modules,','),',')),',')="" +="">=>
)
COUNT (*) 2 Concerning
Etbin
Select count (*)
of usr_mods
where instr ((select ',' | to_char (rtrim (ltrim(TS_MODULES,','), ',')) |)) ','
of usr_rfc
where TS_KINTANA_PACKAGE_NUMBER = '123'
and ts_projectid = 3
),
',' || TO_CHAR (TS_ID) | ','
) > 0
-
Hello.
I work in a big project on my main composition in 2015 of EI, Yosemite 10.10.5 and always return all night but cannot give more than one inside and out...?
If I give several definitions in my composition to queue rendering, After Effects rendered all points, but only the last again and again.
I never need to make multiple files during the night, so I don't know if this is normal or there at - there a Posibility to return more control then a?
Kind regards
Florian.
It's one of these bugs CC 2015. It would be possible to set using render settings different, it seems to occur with specific formats.
Mylenium
-
Query with a subquery should return a value but does not work
When I run this SQL, it does not return value:
SELECT vfn.cat
OF vfn, valid_fishery vf vps_fishery_ner
WHERE vfn.plan = vf.plan
AND vfn.cat = vf.cat
AND vf.permit_year = 2010
AND vf.moratorium_fishery 't ='
AND vfn.vp_num = 211652
AND vfn.ap_year = 2010
AND vfn.plan = 'MUL '.
AND vfn.date_issued = (SELECT MAX (date_issued)
OF vps_fishery_ner
WHERE vp_num = 211652
AND ap_year = 2010);
To test, I remove the subquery and run it separately:
SELECT MAX (date_issued)
OF vps_fishery_ner
WHERE vp_num = 211652
AND ap_year = 2010;
Returns 2 April 10
Then I paste the date into the original query (using her TRUNCATES the function, of course, since I'm only part DDMMYY hardcode the date):
SELECT vfn.cat
OF vfn, valid_fishery vf vps_fishery_ner
WHERE vfn.plan = vf.plan
AND vfn.cat = vf.cat
AND vf.permit_year = 2010
AND vf.moratorium_fishery 't ='
AND vfn.vp_num = 211652
AND vfn.ap_year = 2010
AND vfn.plan = 'MUL '.
AND TRUNC (date_issued) = TO_DATE('02-APR-10');
And returns the required value, "A".
So why the complete query with a subquery does not work, if the value returned by the subquery is valid and works when you just pasted in there?
Thank you.Hello
Maybe you should include this in the subquery as well?
AND vfn.plan = 'MUL'
Maybe you are looking for
-
Some songs sync on my Apple Watch
When I tried to sync a playlist to my watch some songs do not synchronize. The app said they all did and all the songs are downloaded on my phone. Help, please.
-
Cannot send emails from my IPhone 6
I can't send emails from my IPhone 6, iOS 9.2. Anyone know what to do?
-
Windows 7 USB/DVD Download Tool &#62; &#62; I can't clear it
My problem is the same title. Well, I delete it, but it is still on my Uninstall list I erased the with Revo Uninstaller, using the more complicated method (which deletes the unwanted file that are left) After this, I check Revo Uninstaller, so I can
-
BlackBerry® Smartphones do not receive email on my Blackberry pearl 8100
Hello. I do not receive email on my BlackBerry smart phone. my blackberry is related to one of my gmail account. I can send emails from this device. I received no e-mail confirmation to add my gmail and create my blackberry email account. I am very n
-
Execution of the procedure of Oracle APEX
HelloI've written a procedure ' create or replace PROCEDURE process_csvfile (p_filename IN VARCHAR2); " et I want to execute this procedure to Oracle Apex.PROCEDURE: create or replace PROCEDURE process_csvfile(p_filename IN VARCHAR2) AS statement1 va