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

Tags: Oracle Development

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;

  • 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.

  • "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_ID

    Use
    ' 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

  • 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 you

    Try 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
      )
    
  • First 4.0.0.12.84 (ORA-01427 einreihig subquery returns more than one line)

    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!

  • 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:
    with
    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;
    Published by: layout of the code user574699 on November 17, 2008 02:10

    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

  • 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

  • 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
    Belin
    Try 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;
    
  • Dynamic text to scroll more than one line

    Hello, been racking my brain for weeks with that. trying to get my external dynamic text loaded to scroll. My code to do appear and scroll down to a single line at a time works fine, but if I replace the code 'scroll buttons' with the code "NEW buttons scroll" to try to get the ti to scroll more than one line - it scrolls is no longer at all. I included my code below in the hope that maybe, it is a problem of simple target path. Thank you!

    change the .scroll + / = 1 to a value greater than 1 to scroll more lines. 1 = 1 line

  • "Getting the error 'exact fetch returns more than number of lines.

    Hi try to run a query of Iam
    but when I run what it it gives an error
    Error report:
    ORA-01422: exact fetch returns more than number of lines
    ORA-06512: at line 9 level
    01422 00000 - "exact fetch returns more than number of lines."
    * Cause: Exact extraction specified number is less than the returned rows.
    * Action: Rewrite the query or change the number of rows requested
    here's my querey

    SET SERVEROUTPUT ON
    DECLARE
    Emp_table_type TYPE IS an ARRAY OF
    hr_api_transactions % ROWTYPE INDEX BY PLS_INTEGER;
    my_emp_table emp_table_type;

    BEGIN
    I'm in 1.53
    LOOP
    SELECT * INTO my_emp_table (i) FROM hr_api_transactions
    WHERE transaction_ref_table = 'PER_ALL_VACANCIES ';
    END LOOP;
    BECAUSE me IN my_emp_table. FIRST... my_emp_table. LAST
    LOOP
    DBMS_OUTPUT. Put_line (my_emp_table (i) .transaction_document);
    END LOOP;
    END;

    Hello

    'Re missing you the bulk of the Collections. Ask that you well want to have a glance on manual of oracle collections.
    Replace your code...

    DECLARE
    TYPE emp_table_type IS TABLE OF
    hr_api_transactions%ROWTYPE INDEX BY PLS_INTEGER;
    my_emp_table emp_table_type;
    BEGIN
    SELECT *
    BULK COLLCT INTO my_emp_table
    FROM hr_api_transactions
    WHERE transaction_ref_table = 'PER_ALL_VACANCIES';
    FOR i IN my_emp_table.FIRST..my_emp_table.LAST
    LOOP
    DBMS_OUTPUT.PUT_LINE(my_emp_table(i).transaction_document);
    END LOOP;
    END;
    

    Before you run the above script, don't forget to run the

    set serveroutput on
    

    I hope this helps.

    PS-> mark as Complete/useful, if the apporoach above meets the expected result

    Kind regards
    Claudy

  • Tabular report with more than one line by line

    Hello

    I designed a sort of Gallery page, a tabular report with only two small columns per line: a thumbnail from a BLOB column and link textual branching to a page showing the full size image with a bunch of textual information on this subject.

    As you can guess I look at the title of the topic, my concern is to display more than one (say 3 or 4) this line by line, in order to avoid a very long 'portrait' page with a lot of white space on the left and right.

    Is there a (not too complicated) way to do it? I might design a special model (?), but I'm not very used to style sheets and stuff.

    Thanks in advance.

    André

    Re: report columns of the SQL query for a couple of ways to do this.

    As your main concern is to maximize the use of horizontal space, custom report template/CSS approach would seem more appropriate, as the number of columns is not resolved.

    It is also possible to do using CSS inline-block property and given that it is now feasible cross-browser and less side effects and potential problems that the use of floats is probably the way to go.

  • I'm confused as to what to choose. Lightroom 5.1 or lightroom cc? CC is something more than L5.1 pls help.

    I'm confused.  more L5.1, what LCC. Is is better than the 5.1? EQUAL? I've seen photos modified in L5.1 and were excellent in my opinion. Any suggestions? Thank you!

    Responded to your other thread: I'm confused as to what to choose. lightroom 5.1 or lightroom cc? L cc does have something more that L5.1 pls help.

    We will try to keep all discussions in a thread

  • EXTRACTVALUE returns more than one row error

    Hi gurus

    I have XML file, now I would like to write an SQL to convert tabular. Whne I try to use

    EXTRACTVALUE
    (XML_MESSAGE,
    ' / ATMWithDrawTrans/Trans/Tran/TranDate.

    I'm ExtractValue returns multiple rows. Could you please help me find a query that retrieves these sub table form.

    < ATMWithDrawTrans >
    < Trans >
    < Tran >
    < TranDate > 2001 - 09 - 10 < / TranDate >
    < amount > 105 < / amount >
    < / Tran >
    < Tran >
    < TranDate > 2002 - 03 - 10 < / TranDate >
    < amount > 105 < / amount >
    < / Tran >
    < Tran >
    < TranDate > 2002 - 09 - 10 < / TranDate >
    < amount > 104 < / amount >
    < / Tran >
    < Tran >
    < TranDate > 2003 - 03 - 10 < / TranDate >
    < amount > 104 < / amount >
    < / Tran >
    < Tran >
    < TranDate > 2003 - 09 - 10 < / TranDate >
    < amount > 103 < / amount >
    < / Tran >
    < / Trans >
    < / ATMWithDrawTrans >

    TIA

    Published by: 870046 on July 25, 2011 08:50

    XMLTable will do what you want.

    For example, assuming XML_MESSAGE is a database of XMLType column:

    select x.*
    from your_table t
       , xmltable('/ATMWithDrawTrans/Trans/Tran'
           passing t.xml_message
           columns tran_date date   path 'TranDate'
                 , amount    number path 'amount'
         ) x
    ;
    

    If your version does not support, see XMLSequence in the documentation.

  • Update TBL to TBL (ORA-01427 ' row subquery returned more line ")

    Hello...

    I'm new in this stuff and need a little help... Thank you very much for your answers!

    I have the error ORA-01427 when run this script:

    Update tblproduct
    the value (instock) = (select b2.instock - tblproduct b2, b1, b3 tblorder tblitem b1.quantity
    where b1.productid = b2.productid and b1.orderid = b3.orderid and b3.orderid to 3025)

    The main purpose of the script is the actualization of the butts of the inventory when the order is completed.

    The TBLITEM primary key (ORDERID and PRODUCTID). This prevents repeat the question on the agenda.


    The structure of tables are:

    1. (TBLITEM)

    Name Null? Type
    ---------------------------------- -------------- ---------------

    PRODUCTID NOT NULL NUMBER (10)
    ORDERID NOT NULL NUMBER (10)
    QUANTITY NOT NULL NUMBER (10)
    PRICE FLOAT (126)
    ITEMID NUMBER (5)



    2. (TBLPRODUCT)

    Name Null? Type
    ----------------------------------------- --------------- --------------------

    PRODUCTID NOT NULL NUMBER (10)
    PRODNAME NOT NULL VARCHAR2 (25)
    DESCRIPTION VARCHAR2 (255)
    PRICE NOT NULL NUMBER (7.2)
    NUMBER (7.2) TAX
    STATUS NOT NULL VARCHAR2 (25)
    NUMBER (10) NOT NULL INSTOCK
    REORDERPOINT NOT NULL NUMBER (10)
    DATE OF RESTOCKDATE
    CATEGORYID NOT NULL NUMBER (10)
    VENDOR NUMBER NO. (10)


    2. (TBLORDER)

    Name Null? Type
    ----------------------------------------- ------------ ----------------

    ORDERID NOT NULL NUMBER (10)
    NOT NULL ORDERDATE DATE
    DATE OF ORDERCOMPT
    USERID NOT NULL NUMBER (10)
    ACCOUNTID NOT NULL NUMBER (10)
    STATUS NOT NULL VARCHAR2 (25)
    NUMBER (2) CANCELLED


    THANKS FOR YOUR HELP ONCE AGAIN!

    Published by: user10084733 on April 20, 2009 12:25

    It is the right way to update your table.

    update tblproduct b2
    set (instock) = (select b2.instock - b1.quantity
                     from tblitem b1, tblorder b3
                     where b1.productid = b2.productid
                     and b1.orderid = b3.orderid
                     and b3.orderid in 3025)
    where exists ( select 1
                   from tblitem b1, tblorder b3
                   where b1.productid = b2.productid
                   and b1.orderid = b3.orderid
                   and b3.orderid in 3025)
    ;
    
    Without the where condition you are updating the full table.
    

Maybe you are looking for

  • Satellite P200 - error code 19

    DVD player does not start. This is a misconfiguration in the register information, code 19. Who knows a solution to this problem? The problem occurs without any change in the system.

  • Impossible to manually stop the structure of the event

    Hello I have a machine program fully functional State to control a stepper motor. However, I face a problem where I'm not able to break the inbetween the delivery of the program by clicking on the stop button to loop MANUALLY. I don't know why he can

  • which antivirus software will work with a new processor 64-bit with 32 bit xp pro?

    Insalled new computer with an older version of xp pro 32 bit and a 64-bit processor.  Need a compatible Antivirus software.  Avast and AVG locked system does not load.

  • want to m6 sleekbook: screen flashing after windows update

    After the update windows 8.1 and later to win 10 screen flashes all the time between desktop screen and blue, already install all updates of HP with the intell and Windows safe mode - the same situation, all reinstalled video drivers by myself, but s

  • Check box does not appear

    I'm trying to install Acrobat Professional 8 on my Mac, which is running El Capitan.It seems to have installed properly, but when I go to the help icon and click on registration, a window opens, but it never shows anything.I don't know if I need to u