Help with the query---urgent

PROCEDURE Mktg_Obj_Cmpgn(p_attr_tbl_nm IN attr.attr_tbl_nm%TYPE,p_actn_cd IN chg_log.actn_cd%TYPE) IS
v_tbl_nm varchar2(100);
v_actn_cd varchar2(4);
BEGIN
v_tbl_nm := p_attr_tbl_nm;
v_actn_cd := p_actn_cd;
--dbms_output.put_line(v_tbl_nm);
IF v_actn_cd = 'CRET' THEN
SELECT to_clob(XMLELEMENT("requestmessage",XMLATTRIBUTES(xmlforest(
seq_pblsh_rqst.nextval AS "publish_id")),
XMLAGG(XMLELEMENT("campaign",XMLATTRIBUTES(XMLFOREST(chg.actn_cd AS "ACTION",
pgm.program_idseq AS "parententityvalue",
ent_sbsrb.ENT_ID AS "entid",
pgm.campaign_idseq AS "campaignid",
bus_unt.portfolio_subtype_id AS "campaignsegment",
pgm_typ.pgm_type_nm AS "campaigntype",
LKP.lookup_key_desc AS "campaignclass",
pgm.editor_userid AS "campaignlastmodifiedby",
pgm.edited_dtm AS "campaignlastmodifieddate",
pgm.mkt_initv_proc_tx AS "campaignlink",
ofr.offer_idseq AS "offerlink")))),
XMLAGG(XMLELEMENT("PROCESSCODE", XMLATTRIBUTES(XMLFOREST(action as "link",PROGRAM.program_idseq AS "parententityvalue",
ENT_SBSRB_ATTR.ent_id AS "entid"))))))AS "v_clob" into v_clob1
FROM dual,
chg_log chg,
program pgm,
ent_sbsrb_attr ent_sbsrb,
business_unit bus_unt,
program_type pgm_typ,
offer ofr,
(SELECT lookup_keyword,lookup_key_desc,lookup_type
FROM lookup_key
WHERE lookup_type = 'PRTFL_CMPGN_ID')LKP
WHERE chg.attr_id = ent_sbsrb.attr_id
and chg.parnt_ent_val_tx = to_char(pgm.program_idseq)
and pgm.business_unit_idseq = bus_unt.business_unit_idseq
and pgm.pgm_type_cd = pgm_typ.pgm_type_cd
and ofr.program_idseq = pgm.program_idseq
and pgm.pgm_cls_cd(+) = LKP.lookup_keyword;
END IF;
end Mktg_Obj_Cmpgn;
I have this procedure within a package. v_clob1 is declared in packagebody as a CLOB variable. when i try to compile it i am getting the below given error.can anyone please help me?
(1): PL/SQL: ORA-19208: parameter 1 of function XMLELEMENT must be aliased
(2): PL/SQL: SQL Statement ignored

hi sir,
wanna ask u guyz one query
let say i have table name account(parent) and service(child)
account
id name status
1 john 0
2 ki 1
3 kdf 2
service
id trans_id name status
1 1 et 9999
1 2 eee 2222
2 3 ere 999
2 4 wew 0
i plan to use something like this
delete account from account t1,service t2 where t1id=t2.id and t1.status<>0;
but sql command not correct so plz help me
now i need a query to delete records from service table only but
account.status <> 0 and accound.id=service.id
i dunt want to delete record from account table
so can u help me with this query
thanks
Message was edited by:
mani_um

Similar Messages

  • Need urgent help with the query - Beginer

    Hello - I need help with a query to populate data in a table.Here is the scenario.
    Source1
    MnthID BranchCod CustID SegCode FXStatus ProfStatus Profit
    200712 B1 C1 20 Y Y 100
    Source2
    MnthID BranchCod CustID ProdCode ProdIndex
    200712 B1 C1 12 1
    200712 B1 C2 12 0
    Destination
    MnthID BranchCod SegCode ProdCode CountSegCust CountProdCust ProfitProdCust
    Condition and Calculations:
    1)Source1 customer are base customers.If Source2 has customers who is not in source1 then that customer's record should not be fetched.
    2)SegCode, FX Status, ProfStatus is one variable in destination table. [ SegCode = SegCode+ FXStatus (if FXStatus = Y)+ ProfStatus (if FXStatus = Y) ]
    3)CountSegCust = CountCustID Groupby MnthID,BranchCod,SegCode Only.
    4)CountProdCust = CountCustID Groupby MnthID,BranchCod,SegCode,ProdCode (when ProdIndex = 1)
    5)ProfitProdCust = Sum of Profit of Customers Groupby MnthID,BranchCod,SegCode,ProdCode (when ProdIndex = 1)
    Apologies for bad formatting.
    Thanks in advance!!

    A total guess indeed.
    It's not clear whether some aggregation can be done (summing counts of grouped data might cause some customers being counted more than once)
    insert into destination
    select mnthid,branchcod,segcode,prodcode,countsegcust,countprodcust,profitprodcust
      from (select s1.mnthid,
                   s1.branchcod,
                   s1.segcode || case s1.fxstatus when 'Y' then s1.fxstatus || s1.profstatus end segcode,
                   s2.prodcode,
                   count(s1.custid) over (partition by s1.mnthid,
                                                       s1.branchcod,
                                                       s1.segcode || case s1.fxstatus when 'Y' then s1.fxstatus || s1.profstatus end
                                              order by null
                                         ) countsegcust,
                   count(case proindex when 1
                                       then custid
                         end
                        ) over (partition by s1.mnthid,
                                             s1.branchcod,
                                             s1.segcode || case s1.fxstatus when 'Y' then s1.fxstatus || s1.profstatus end
                                             s2.prodcode
                                    order by null
                               ) countprodcust,
                   sum(case proindex when 1
                                     then profit
                       end
                      ) over (partition by s1.mnthid,
                                           s1.branchcod,
                                           s1.segcode || case s1.fxstatus when 'Y' then s1.fxstatus || s1.profstatus end
                                           s2.prodcode
                                  order by null
                             ) profitprodcust,
                   row_number() over (partition by s1.mnthid,
                                                   s1.branchcod,
                                                   s1.segcode || case s1.fxstatus when 'Y' then s1.fxstatus || s1.profstatus end
                                                   s2.prodcode
                                          order by null
                                     ) the_row
              from source1 s1,source2 s2
             where s1.mnthid = s2.mnthid
               and s1.branchcod = s2.branchcod
               and s1.custid = s2.custid
    where the_row = 1Regards
    Etbin

  • Need help with the query -

    We have these two tables and trying to see if the amount in one table is equal to the sum of the amount fields in another table.
    Can someone please help?
    SQL> desc test;
    Name Null? Type
    KEY NUMBER(9)
    AMOUNT NUMBER(11,2)
    SQL> desc test1;
    Name Null? Type
    KEY NUMBER(9)
    TOTAL_AMOUNT NUMBER(11,2)
    SQL> select * from test;
    KEY AMOUNT
    1 10
    1 20
    1 70
    3 rows selected.
    SQL> select * from test1;
    KEY TOTAL_AMOUNT
    1 100
    1 row selected.
    SQL> select count(*) from test1 a where exists(select 'x' from test b where
    2 a.key=b.key and a.total_amount!=sum(b.amount));
    a.key=b.key and a.total_amount!=sum(b.amount))
    ERROR at line 2:
    ORA-00934: group function is not allowed here

    Hi,
    This would be so easy if there was a table like test that only had one row per key!
    You can make such a table, or you can just make a sub-query that has all the same data, and use that sub-query as if it were a table.
    For example:
    WITH  one_row_per_key_test  AS
        SELECT    key
        ,         SUM (amount)  AS total_amount
        FROM      test
        GROUP BY  key
    SELECT  COUNT (*)
    FROM    test1   a
    WHERE   EXISTS
            SELECT  'x'
            FROM    one_row_per_key_test  b
            WHERE   a.key          = b.key
            AND     a.total_amount = b.total_amount
            );There are lots of other ways to solve this particular problem (including HAVING), but this is a very important technique to know.

  • Need help with the query to write Cipher?

    Hi, 
    I was assigned a task to write a query to encrypt and decrypt some Cipher.  I have figured out to write the procedure to encrypt and decrypt ceasar cipher. I would really appericate if you guys could help me out with this.
    .Caesar Cipher
    2.Monoalphabetic Cipher
    3.Playfair Cipher
    4.Vigenère Cipher
    5.Transposition Ciphers
    6.Rail Fence cipher
    7.Row Transposition Cipher

    Hi , 
    I sorry about just giving the names to when i resarched i saw Rail Fnce Cipher and Ceasar Cipher are the most easier ones.
    This is how rail fence cipher works .
    Codes and Ciphers :: Rail Fence
    In the rail fence cipher, the plaintext is written downwards on successive "rails" of an imaginary fence, starting a new column when the bottom is reached. The message is then read off in rows. For
    example, if we have 3 rails and a message of "This is a secret message", you would write out:
    T S A C T S G
    H I S R M S E
    I S E E E A J
    The last J is just a random letter to fill in the space. The secret message is then condensed and regrouped.
    TSACT SGHIS RMSEI SEEEA JGURL
    To decipher a message you must know the number of rails that were used to encipher it. You then break up the letters into equal groups for each rail. For example, if you are using 3 rails, you
    would break the secret message into 3 equal groups. Now you stack the groups on top of each other and read off the message vertically. If you get gibberish, then there are probably some extra letters tacked on the end of the message that are throwing off the
    grouping. Try removing one letter from the end and try again.
    So if the number of rails =3
    Plaintext :- "This is a sccerect message"
    Cipher Text:-"TSACTSGHISRMEISEEEAJ"
    Can we figure out to write a procedure or function for this.
    Rail Fence Encoder / Decoder
    Number of rails: <input class="form_txt_gr" maxlength="2" name="rails" size="3" style="font-family:verdana, arial, sans-serif;font-size:10px;vertical-align:middle;border:1px solid rgb(0, 0, 0);padding:2px 1px;margin:0px 5px 0px 2px;background-color:#ffffdd;"
    type="text" value="3" />
    Plaintext
    <textarea class="form_txt_gr" cols="40" name="message" rows="5" style="font-family:verdana, arial, sans-serif;font-size:10px;vertical-align:middle;border-color:#000000;padding-right:1px;padding-margin:0px 5px 0px 2px;background-color:#ffffdd;"></textarea>
    Ciphertext
    <textarea class="form_txt_gr" cols="40" name="encoded" rows="5" style="font-family:verdana, arial, sans-serif;font-size:10px;vertical-align:middle;border-color:#000000;padding-right:1px;padding-margin:0px 5px 0px 2px;background-color:#ffffdd;"></textarea>
    <input class="form_submit_gr" name="encipher" style="font-family:verdana, arial, sans-serif;font-size:10px;vertical-align:middle;color:#000000;border:1px solid rgb(0, 0, 0);font-weight:bold;padding-right:1px;padding-margin:0px;background-color:#ffcc66;" type="submit"
    value="Encipher" /> <input class="form_submit_gr" name="decipher" style="font-family:verdana, arial, sans-serif;font-size:10px;vertical-align:middle;color:#000000;border:1px solid rgb(0, 0, 0);font-weight:bold;padding-right:1px;padding-margin:0px;background-color:#ffcc66;"
    type="submit" value="Decipher" />
    Rail Fence Encoder / Decoder
    Number of rails: <input class="form_txt_gr" maxlength="2" name="rails" size="3" style="font-family:verdana, arial, sans-serif;font-size:10px;vertical-align:middle;border:1px solid rgb(0, 0, 0);padding:2px 1px;margin:0px 5px 0px 2px;background-color:#ffffdd;"
    type="text" value="3" />
    Plaintext
    <textarea class="form_txt_gr" cols="40" name="message" rows="5" style="font-family:verdana, arial, sans-serif;font-size:10px;vertical-align:middle;border-color:#000000;padding-right:1px;padding-margin:0px 5px 0px 2px;background-color:#ffffdd;"></textarea>
    Ciphertext
    <textarea class="form_txt_gr" cols="40" name="encoded" rows="5" style="font-family:verdana, arial, sans-serif;font-size:10px;vertical-align:middle;border-color:#000000;padding-right:1px;padding-margin:0px 5px 0px 2px;background-color:#ffffdd;"></textarea>
    <input class="form_submit_gr" name="encipher" style="font-family:verdana, arial, sans-serif;font-size:10px;vertical-align:middle;color:#000000;border:1px solid rgb(0, 0, 0);font-weight:bold;padding-right:1px;padding-margin:0px;background-color:#ffcc66;" type="submit"
    value="Encipher" /> <input class="form_submit_gr" name="decipher" style="font-family:verdana, arial, sans-serif;font-size:10px;vertical-align:middle;color:#000000;border:1px solid rgb(0, 0, 0);font-weight:bold;padding-right:1px;padding-margin:0px;background-color:#ffcc66;"
    type="submit" value="Decipher" />

  • Please help with the query creating Materialized View

    Hi,
    We are using the below query to create a Materialized View but it has been running since 3 hours. It is an Oracle 9i database running in HP-UX.The quey is as follows,
    (SELECT
    /*+ use_nl(A) parallel (A,4)*/
    A.ICD_CODE AS ICD_CODE,
    A.ICD_DESC AS ICD_DESC,
    A.PROC_GROUP as PROC_GROUP,
    B.COMPL_ICD_CODE AS COMPL_ICD_CODE,
    B.COMPL_GRP_TXT AS COMPL_GRP_TXT,
    C.PROC_TYPE AS PROC_TYPE ,
    C.I_O_IND AS I_O_IND,
    C.DISC_MON AS QUARTER ,
    B.PAT_KEY AS PAT_KEY ,
    D.COMPL_TYPE_TXT AS COMPL_TYPE_TXT ,
    C.PROV_ID AS PROV_ID ,
    A.SPECIALTY AS SPECIALTY
    FROM
    EES_ICD_9_CODE A ,
    EES_CLINICAL_COMPL_DATA B,
    EES_CLINICAL_DATA C,
    EES_CLINCL_COMPL_ICD D                                                                            
    WHERE A.ICD_CODE= B.ICD_CODE
                    AND B.ICD_CODE= C.ICD_CODE
                    AND B.COMPL_ICD_CODE=D.ICD_9_CD
                    AND B.PAT_KEY=C.PAT_KEY
                    AND B.COMPL_ICD_CODEB.ICD_CODE
                    AND C.PROC_TYPE  'L'
                    AND B.COMPL_GRP_TXT'Reoperations'
                    AND D.COMPL_TYPE_TXT'Intra-operative Misadventure'
                    AND C.DISC_MON>='2003101'
                    AND A.SPECIALTY='Colo-Rectal')
    union
    (SELECT
    /*+ use_nl(A) parallel (A,4)*/
    A.ICD_CODE AS ICD_CODE,
    A.ICD_DESC AS ICD_DESC,
    A.PROC_GROUP as PROC_GROUP,
    B.COMPL_ICD_CODE AS COMPL_ICD_CODE,
    B.COMPL_GRP_TXT AS COMPL_GRP_TXT,
    C.PROC_TYPE AS PROC_TYPE ,
    C.I_O_IND AS I_O_IND,
    C.DISC_MON AS QUARTER ,
    B.PAT_KEY AS PAT_KEY ,
    D.COMPL_TYPE_TXT AS COMPL_TYPE_TXT ,
    C.PROV_ID AS PROV_ID ,
    A.SPECIALTY AS SPECIALTY
    FROM
    EES_ICD_9_CODE A ,
    EES_CLINICAL_COMPL_DATA B,
    EES_CLINICAL_DATA C,
    EES_CLINCL_COMPL_ICD D                                                                            
    WHERE A.ICD_CODE= B.ICD_CODE
                    AND B.ICD_CODE= C.ICD_CODE
                    AND B.COMPL_ICD_CODE=D.ICD_9_CD
                   AND B.PAT_KEY=C.PAT_KEY
                    AND B.COMPL_ICD_CODEB.ICD_CODE
                    AND C.PROC_TYPE  'L'
                    --AND B.COMPL_GRP_TXT'Reoperations'
                    AND D.COMPL_TYPE_TXT='Intra-operative Misadventure'
                    AND B.PROC_DAY=C.PROC_DAY
                    AND C.DISC_MON>='2003101'
                    AND A.SPECIALTY='Colo-Rectal')
    union
    (SELECT
    /*+ use_nl(A) parallel (A,4)*/
    A.ICD_CODE AS ICD_CODE,
    A.ICD_DESC AS ICD_DESC,
    A.PROC_GROUP as PROC_GROUP,
    B.COMPL_ICD_CODE AS COMPL_ICD_CODE,
    B.COMPL_GRP_TXT AS COMPL_GRP_TXT,
    C.PROC_TYPE AS PROC_TYPE ,
    C.I_O_IND AS I_O_IND,
    C.DISC_MON AS QUARTER ,
    B.PAT_KEY AS PAT_KEY ,
    D.COMPL_TYPE_TXT AS COMPL_TYPE_TXT ,
    C.PROV_ID AS PROV_ID ,
    A.SPECIALTY AS SPECIALTY
    FROM
    EES_ICD_9_CODE A ,
    EES_CLINICAL_COMPL_DATA B,
    EES_CLINICAL_DATA C,
    EES_CLINCL_COMPL_ICD D                                                                            
    WHERE A.ICD_CODE= B.ICD_CODE
                    AND B.ICD_CODE= C.ICD_CODE
                    AND B.COMPL_ICD_CODE=D.ICD_9_CD
                    AND B.PAT_KEY=C.PAT_KEY
                    AND B.COMPL_ICD_CODEB.ICD_CODE
                    AND C.PROC_TYPE  'L'
                    AND B.COMPL_GRP_TXT='Reoperations'
                    --AND D.COMPL_TYPE_TXT='Intra-operative Misadventure'
                    AND B.PROC_DAY>C.PROC_DAY
                    AND C.DISC_MON>='2003101'
                    AND A.SPECIALTY='Colo-Rectal')
    The explain plan is as follows,
    PLAN_TABLE_OUTPUT
    | Id  | Operation                          |  Name                    | Rows  | Bytes |TempSpc| Cost  |  TQ    |IN-OUT| PQ Distrib |
    |   0 | SELECT STATEMENT                   |                          | 46935 |  6716K|       | 10648 |        |      |            |
    |   1 |  SORT UNIQUE                       |                          | 46935 |  6716K|    14M| 10648 | 45,14  | P->S | QC (RAND)  |
    |   2 |   UNION-ALL                        |                          |       |       |       |       | 45,13  | P->P | HASH       |
    |*  3 |    HASH JOIN                       |                          | 42801 |  6102K|       |  4640 | 45,13  | PCWP |            |
    |*  4 |     TABLE ACCESS FULL              | EES_CLINCL_COMPL_ICD     |   875 | 18375 |       |     2 | 45,02
    |*  5 |     HASH JOIN                      |                          | 41552 |  5072K|    14M|  4638 | 45,13  | PCWP |            |
    |*  6 |      TABLE ACCESS FULL             | EES_CLINICAL_DATA        |  1430K|    40M|       |  2855 | 45,03
    |*  7 |      HASH JOIN                     |                          |   628K|    56M|       |   494 | 45,10  | P->P | HASH       |
    |*  8 |       TABLE ACCESS FULL            | EES_ICD_9_CODE           |    37 |  2183 |       |     1 | 45,08 
    |*  9 |       TABLE ACCESS BY INDEX ROWID  | EES_CLINICAL_COMPL_DATA  |  2090K|    71M|       |   49
    |  10 |        BITMAP CONVERSION TO ROWIDS |                          |       |       |       |       |        |    
    |* 11 |         BITMAP INDEX FULL SCAN     | INX_COMPL_GRP            |       |       |       |       |        |
    |* 12 |    TABLE ACCESS BY INDEX ROWID     | EES_CLINICAL_DATA        |     1 |    33 |       |     1
    |  13 |     NESTED LOOPS                   |                          |  1327 |   196K|       |   947 | 45,13  | PCWP |            |
    |* 14 |      HASH JOIN                     |                          | 60205 |  6996K|       |   495 | 45,13  | PCWP |            |
    |  15 |       TABLE ACCESS BY INDEX ROWID  | EES_CLINCL_COMPL_ICD     |    36 |   756 |       |    
    |* 16 |        INDEX RANGE SCAN            | COMPL_TYPE_TXT_3         |     1 |       |       |     1 |     
    |* 17 |       HASH JOIN                    |                          |  1420K|   132M|       |   494 | 45,13  | PCWP |            |
    |* 18 |        TABLE ACCESS FULL           | EES_ICD_9_CODE           |    37 |  2183 |       |     1 | 45,11 
    |* 19 |        TABLE ACCESS BY INDEX ROWID | EES_CLINICAL_COMPL_DATA  |  4722K|   175M|       |   49
    |  20 |         BITMAP CONVERSION TO ROWIDS|                          |       |       |       |       |        |      |           
    |  21 |          BITMAP INDEX FULL SCAN    | INX_COMPL_GRP            |       |       |       |       |        |
    |* 22 |      INDEX RANGE SCAN              | EES_CLINICAL_DATA_IND1   |     1 |       |       |     2 | 45,13
    |* 23 |    HASH JOIN                       |                          |  2807 |   416K|       |  4695 | 45,13  | PCWP |            |
    |  24 |     TABLE ACCESS FULL              | EES_CLINCL_COMPL_ICD     |   911 | 19131 |       |     2 | 45,06
    |* 25 |     HASH JOIN                      |                          |  2617 |   334K|    15M|  4693 | 45,13  | PCWP |            |
    |* 26 |      TABLE ACCESS FULL             | EES_CLINICAL_DATA        |  1430K|    45M|       |  2855 | 45,07
    |* 27 |      HASH JOIN                     |                          |   791K|    74M|       |   305 | 45,12  | P->P | HASH       |
    |* 28 |       TABLE ACCESS FULL            | EES_ICD_9_CODE           |    37 |  2183 |       |     1 | 45,09 
    |* 29 |       TABLE ACCESS BY INDEX ROWID  | EES_CLINICAL_COMPL_DATA  |  2632K|    97M|       |   30
    |  30 |        BITMAP CONVERSION TO ROWIDS |                          |       |       |       |       |        |    
    |* 31 |         BITMAP INDEX SINGLE VALUE  | INX_COMPL_GRP            |       |       |       |       |        |
    Predicate Information (identified by operation id):
       3 - access("B"."COMPL_ICD_CODE"="D"."ICD_9_CD")
       4 - filter("D"."COMPL_TYPE_TXT"'Intra-operative Misadventure')
       5 - access("B"."ICD_CODE"="C"."ICD_CODE" AND "B"."PAT_KEY"="C"."PAT_KEY")
       6 - filter("C"."PROC_TYPE"'L' AND "C"."DISC_MON">=2003101)
       7 - access("A"."ICD_CODE"="B"."ICD_CODE")
       8 - filter("A"."SPECIALTY"='Colo-Rectal')
       9 - filter("B"."COMPL_ICD_CODE""B"."ICD_CODE")
      11 - filter("B"."COMPL_GRP_TXT"'Reoperations')
      12 - filter("B"."ICD_CODE"="C"."ICD_CODE" AND "C"."PROC_TYPE"'L' AND "B"."PROC_DAY"="C"."PROC_DA
      14 - access("B"."COMPL_ICD_CODE"="D"."ICD_9_CD")
      16 - access("D"."COMPL_TYPE_TXT"='Intra-operative Misadventure')
      17 - access("A"."ICD_CODE"="B"."ICD_CODE")
      18 - filter("A"."SPECIALTY"='Colo-Rectal')
      19 - filter("B"."COMPL_ICD_CODE""B"."ICD_CODE")
      22 - access("B"."PAT_KEY"="C"."PAT_KEY")
      23 - access("B"."COMPL_ICD_CODE"="D"."ICD_9_CD")
      25 - access("B"."ICD_CODE"="C"."ICD_CODE" AND "B"."PAT_KEY"="C"."PAT_KEY")
           filter("B"."PROC_DAY">"C"."PROC_DAY")
      26 - filter("C"."PROC_TYPE"'L' AND "C"."DISC_MON">=2003101)
      27 - access("A"."ICD_CODE"="B"."ICD_CODE")
      28 - filter("A"."SPECIALTY"='Colo-Rectal')
      29 - filter("B"."COMPL_ICD_CODE""B"."ICD_CODE")
      31 - access("B"."COMPL_GRP_TXT"='Reoperations')
    Note: cpu costing is offPlease help.

    Try removing the hints.
    Is 47,000 a reasonable estimate of how many rows you expect in the results?
    See these posts for other information that you should supply.
    HOW TO: Post a SQL statement tuning request
    HOW TO: Post a SQL statement tuning request - template posting
    When your query takes too long
    When your query takes too long ...

  • Please help with the query (INSERT RETURNING BULK COLLECT INTO)

    I am trying to write a query inside the C# code where I would insert values into a table in bulk using bind variables. But I also I would like to receive a bulk collection of generated sequence number IDs for the REQUEST_ID. I am trying to use RETURNING REQUEST_ID BULK COLLECT INTO :REQUEST_IDs clause where :REQUEST_IDs is another bind variable
    Here is a full query that use in the C# code
    INSERT INTO REQUESTS_TBL(REQUEST_ID, CID, PROVIDER_ID, PROVIDER_NAME, REQUEST_TYPE_ID, REQUEST_METHOD_ID, SERVICE_START_DT, SERVICE_END_DT, SERVICE_LOCATION_CITY, SERVICE_LOCATION_STATE, BENEFICIARY_FIRST_NAME,
    BENEFICIARY_LAST_NAME, BENEFICIARY_DOB, HICNUM, CCN, CLAIM_RECEIPT_DT, ADMISSION_DT, BILL_TYPE,
    LANGUAGE_ID, CONTRACTOR_ID, PRIORITY_ID, UNIVERSE_DT, REQUEST_DT, BENEFICIARY_M_INITIAL,
    ATTENDING_PROVIDER_NUMBER, BILLING_NPI, BENE_ZIP_CODE, DRG, FINAL_ALLOWED_AMT, STUDY_ID, REFERRING_NPI)
    VALUES
    (SQ_CDCDATA.NEXTVAL, :CIDs, :PROVIDER_IDs, :PROVIDER_NAMEs, :REQUEST_TYPE_IDs,
    :REQUEST_METHOD_IDs, :SERVICE_START_DTs, :SERVICE_END_DTs, :SERVICE_LOCATION_CITYs,
    :SERVICE_LOCATION_STATEs, :BENEFICIARY_FIRST_NAMEs, :BENEFICIARY_LAST_NAMEs, :BENEFICIARY_DOBs,
    :HICNUMs, :CCNs, :CLAIM_RECEIPT_DTs, :ADMISSION_DTs, :BILL_TYPEs, :LANGUAGE_IDs,
    :CONTRACTOR_IDs, :PRIORITY_IDs, :UNIVERSE_DTs, :REQUEST_DTs, :BENEFICIARY_M_INITIALs,
    :ATTENDING_PROVIDER_NUMBERs, :BILLING_NPIs, :BENE_ZIP_CODEs, :DRGs, :FINAL_ALLOWED_AMTs,
    :STUDY_IDs, :REFERRING_NPIs) RETURNING REQUEST_ID BULK COLLECT INTO :REQUEST_IDs
    However, when I run this query, it gives me a strange error ORA-00925: missing INTO keyword. I am not sure what that error means since I am not missing any INTOs
    Please help me resolve this error or I would appreciate a different solution
    Thank you

    You cannot use (and do not want to in this case) the BULK COLLECT.
    create table for_testing
       the_id      number not null primary key,
       some_data   number
    declare
       l_return_value for_testing.the_id%type;
    begin
      4 
       insert into for_testing
          the_id,
          some_data
       values
          1,
          5
       returning the_id into l_return_value;
       dbms_output.put_line('the return values is ' || l_return_value);
    end;
    20  /
    the return values is 1
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.02
    TUBBY_TUBBZ?Is a simple example. In the future, please use the tags to preserve formatting on your code like i have so it remains readable .                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Performance Issue with the Query urgent

    is there any way to get the data for the material Rejected with Movement type 122 & 123 except MSEG table, as my report is very slow...
    my query is as below : -
    SELECT SUM( a~dmbtr )INTO value1
        FROM mseg AS a INNER JOIN mkpf AS b
             ON amblnr = bmblnr
            AND amjahr = bmjahr
          WHERE a~lifnr = p_lifnr
            AND a~bwart IN ('122')
            AND b~budat IN s_budat
          GROUP BY lifnr.
      ENDSELECT.
    abhishek suppal

    Hi Abhi,
    Try like this ....
    SELECT SUM( a~dmbtr )INTO value1
    FROM mseg AS a INNER JOIN mkpf AS b
    ON amblnr = bmblnr
    AND amjahr = bmjahr
    WHERE a~lifnr = p_lifnr
    AND a~bwart IN ('122'<b>,'123'</b>)
    AND b~budat IN s_budat
    GROUP BY lifnr.
    ENDSELECT.
    or ...
    define ranges...like
    ranges: r_bwart for XXXX-bwart.
    r_bwart-sign = 'I'.
    r_bwart-option = 'EQ'.
    r_bwart-low = 122.
    append r_bwart.
    r_bwart-low = 123.
    append r_bwart.
    now...
    in select statement u just add
    AND a~bwart IN r_bwart
    Thanks
    Eswar

  • Help with the query

    Hi
    I need to execute a select statement base on an input parameter like the following. Please share your thoughts
    select (case when param = 1 then
    (select * from emp_1 a,dept_1 b
    where a.dept_no=b.dept_no)
    when param = 2 then
    (select * from emp_2 a,dept_2 b
    where a.dept_no=b.dept_no)
    else
    end)
    from dual
    Thanks

    WITH emp_1 AS
         (SELECT 1 param, 2 dept_no
            FROM DUAL),
         dept_1 AS
         (SELECT 1 param, 2 dept_no
            FROM DUAL)
    SELECT (CASE
               WHEN a.param = 0
                  THEN (SELECT b.param
                          FROM emp_1 b
                         WHERE a.dept_no = b.dept_no)
                         ELSE 1
            END)
      FROM dept_1 a
    try something like this

  • Help wit the query

    I need help with the query
    Here is what I need
    For a particular comm record if there is no Salary record where comm:Date = Salary:Date, then
    • Find maximum dated Salary record as of comm:Date.
    • Clone this record and set Salary:Date = comm:Date
    • Set Salary:rate = comm:rate
    Like wise for a particular Salary record If there is no comm record where Salary:Date = comm:Date then
    • Find maximum effective dated comm record as of Salary:Date
    • Apply Rate 2 amount from this maximum effective dated record to Salary record i.e. Set Salary:rate = comm:rate
    Example
    Salary Table :
    ID Sal_Date Rate Hours
    1 07/01/2011 400.00 40
    2 02/15/2011 200.00 40
    3 01/01/2011 160.00 40
    Sal_comm Table:
    Sal_Date comm_Rate
    1 07/01/2011 10.00
    4 03/01/2011 7.50
    3 01/01/2011 4.00
    I need to merge comm_Rate column in Salary table, since there is no salary record as off 03/01/2011, I need to find the maximum dated salary record as of 03/01/2011
    i.e. the record dated 02/15/2011. Now I need to clone that salary record, set the SAL_date as 03/01/2011 and update Rate2 amount. So the record set will be like:
    Sal_Date:
    id sal_Date Rate Hours comm_Rate
    1 07/01/2011 400.00 40 10.00
    4 03/01/2011 200.00 40 7.50
    2 02/15/2011 200.00 40 4.00
    3 01/01/2011 160.00 40 4.00

    So you need all used dates as the "driving" dataset. And you need the according data for each of these.
    WITH salary_table as
    (select 1 id,to_date('07/01/2011','MM/DD/YYYY')sal_date,400 rate,40 hours from dual union all
    select 2 id,to_date('02/15/2011','MM/DD/YYYY')sal_date,200 rate,40 hours from dual union all
    select 3 id,to_date('01/01/2011','MM/DD/YYYY')sal_date,160 rate,40 hours from dual),
    sal_comm as
    (select 1 id,to_date('07/01/2011','MM/DD/YYYY')sal_date,10 comm_Rate from dual union all
    select 4 id,to_date('03/01/2011','MM/DD/YYYY')sal_date,7.5 comm_Rate from dual union all
    select 3 id,to_date('01/01/2011','MM/DD/YYYY')sal_date,4 comm_Rate from dual)
    select to_char(all_dates.sal_date,'MM/DD/YYYY') sal_date,sal.rate,sal.hours,com.comm_rate
    from (select sal_date from salary_table
          union
          select sal_date from sal_comm) all_dates
    inner join (select s1.*,lead(sal_date-1,1,to_date('31/12/9999','DD/MM/YYYY')) over (order by sal_date) next_sal_date
               from salary_table s1) sal
      on (all_dates.sal_date between sal.sal_date and sal.next_sal_date)
    inner join (select s1.*,lead(sal_date-1,1,to_date('31/12/9999','DD/MM/YYYY')) over (order by sal_date) next_sal_date
               from sal_comm s1) com
      on (all_dates.sal_date between com.sal_date and com.next_sal_date)
    order by   all_dates.sal_date desc;
    SAL_DATE   RATE                   HOURS                  COMM_RATE             
    07/01/2011 400                    40                     10                    
    03/01/2011 200                    40                     7.5                   
    02/15/2011 200                    40                     4                     
    01/01/2011 160                    40                     4                     
         

  • Need some help with the Select query.

    Need some help with the Select query.
    I had created a Z table with the following fields :
    ZADS :
    MANDT
    VKORG
    ABGRU.
    I had written a select query as below :
    select single vkorg abgru from ZADS into it_rej.
    IT_REJ is a Work area:
    DATA : BEGIN OF IT_REJ,
            VKORG TYPE VBAK-VKORG,
            ABGRU TYPE VBAP-ABGRU,
           END OF IT_REJ.
    This is causing performance issue. They are asking me to include the where condition for this select query.
    What should be my select query here?
    Please suggest....
    Any suggestion will be apprecaiated!
    Regards,
    Developer

    Hello Everybody!
    Thank you for all your response!
    I had changes this work area into Internal table and changed the select query. PLease let me know if this causes any performance issues?
    I had created a Z table with the following fields :
    ZADS :
    MANDT
    VKORG
    ABGRU.
    I had written a select query as below :
    I had removed the select single and insted of using the Structure it_rej, I had changed it into Internal table 
    select vkorg abgru from ZADS into it_rej.
    Earlier :
    IT_REJ is a Work area:
    DATA : BEGIN OF IT_REJ,
    VKORG TYPE VBAK-VKORG,
    ABGRU TYPE VBAP-ABGRU,
    END OF IT_REJ.
    Now :
    DATA : BEGIN OF IT_REJ occurs 0,
    VKORG TYPE VBAK-VKORG,
    ABGRU TYPE VBAP-ABGRU,
    END OF IT_REJ.
    I guess this will fix the issue correct?
    PLease suggest!
    Regards,
    Developer.

  • Hi guys can someone help with a query regarding the 'podcast app' why do they not have all the episodes that relate to one show available why only half or a selected amount

    Hi guys can someone help with a query regarding the 'podcast app' why do they not have all the episodes that relate to one show available why only half or a selected amount

    THanks...but some days they have all the episodes right back to the very first show...ive downloaded a few but they are only available every now and then which makes no sense...why not have them available the whole time ??

  • Need some help with the colour profile please. Urgent! Thanks

    Dear all, I need help with the colour profile of my photoshop CS6. 
    I've taken a photo with my Canon DSLR. When I opened the raw with ACDSee, the colour looks perfectly ok.
    So I go ahead and open in photoshop. I did nothing to the photo. It still looks ok
    Then I'm prompt the Embedded Profile Mismatch error. I go ahead and choose Discard the embedded profile option
    And the colour started to get messed up.
    And the output is a total diasater
    Put the above photo side by side with the raw, the red has became crimson!!
    So I tried the other option, Use the embedded profile
    The whole picture turns yellowish in Photoshop's interface
    And the output is just the same as the third option.
    Could someone please guide me how to fix this? Thank you.

    I'm prompt the Embedded Profile Mismatch error. I go ahead and choose Discard the embedded profile option
    always use the embedded profile when opening tagged images in Photoshop - at that point Photoshop will convert the source colors over to your monitor space correctly
    if your colors are wrong at that point either your monitor profile is off, or your source colors are not what you think they are - if other apps are displaying correctly you most likely have either a defective monitor profile or source profile issues
    windows calibrate link:
    http://windows.microsoft.com/en-US/windows7/Calibrate-your-display
    for Photoshop to work properly, i recall you want to have "use my settings for this device" checked in Color Management> Device tab
    you may want to download the PDI reference image to check your monitor and print workflows
    and complete five easy steps to profile enlightenment in Photoshop
    with your settings, monitor profile and source profiles sorted out it should be pretty easy to pinpoint the problem...

  • Content Tab: None of the fact tables are compatible with the query request

    Hi All,
    **One thing I am not clear yet of all my years with OBIEE is working with the content tab in BMM.**
    I have made a rpd the joins in physical layer as shown below:
    https://picasaweb.google.com/114804305606242416264/OBIEEError#5663056545119428530
    And the BMM layer as:
    https://picasaweb.google.com/114804305606242416264/OBIEEError#5663056519553812930
    Error I am getting when i run a request from the 3 columns from the selected 3 tables is:
    Dim - Comment Code Details
    Fact - Complaint
    Dim - Service Details
    Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 14020] None of the fact tables are compatible with the query request Sr Num:[DAggr(Fact - Complaint.Sr Num by [ Dim - Service Details.Sr Cat Type Cd, Dim - Comment Code Details.Cmtcode name] )]. (HY000).
    I get no error for consistency.. I read everywhere and I know i need to set the appropriate aggregation levels in the various dims and facts LTS properties to help OBIEE understanding our model, but how to do that.. how do i decide... how should I approach, what should be the aggregation level, what details.
    When i click More button i see different options: Copy, Copy From, Get Levels, Check Level, what do these mean.
    Aggregation Content, group by - Logical Level or Column which one should i choose and how should I decide.
    Can anyone explain the Content Tab in details and from scratch with some example and why we get these errors.... I know many people who are well versed with many other things related to RPD but this. A little efforts of explaining from you guys will really be appreciated.
    Thanks in advance,
    Dev

    Hi Deepak,
    Option 1:
    My tables in physical layer are joined as below:
    D1--> F1 <--D2--> F2 <--D3
    Same way i model it in BMM
    D1--> F1 <-- D2--> F2 <--D3
    Here D1 is non Conformed Dimension for F2 and D3 is non Conformed dim for F1. Later create Dimensional hierarchies, I tried setting up the content levels
    I go Sources>content tab of Fact F1 I set
    Dimensions----------- Logical level
    D1---------------------- D1 Detail
    D2---------------------- D2 Detail
    D3---------------------- D3 Total
    then, I go Sources>content tab of Fact F2 I set
    Dimensions----------- Logical level
    D1---------------------- D1 Total
    D2---------------------- D2 Detail
    D3---------------------- D3 Detail
    Then, I also go in all the dimensions and set their content levels to Details, but it still gives me errors not sure where I am going wrong in setting the content levels.
    I need to know whether the way I have modeled it in BMM is right,
    Option 2:
    I can combine the two facts in a single Logical Fact or the above design should also work.
    (F1&F2)<--D1, D2 , D3 joined separately using complex logical joins.
    what will be the content tab details?
    Thanks,
    Dev

  • SSMS 2012:XQuery-doing "Retriving Job Candidates with the query Method" in AdventuresWorks 2012. Unclosed quotation mark after string '//*:Name.First?

    Hi all,
    From Page 354 of the the Book "Pro T-SQL 2008 Programmer's Guide" written by Michael Coles (published by apress), I copied the following code (Listing 12-9 Retrieving Job Candidates with the query Method):
    --Coles12_9.sql // saved in C:/Documemnts/SQL Server Management Studio
    -- Coles Listing 12-9 Retrieving Job Candidates with the query Method
    -- Doing XQuery and the xml Data Type in AdvantureWorks
    -- 17 March 2015 1105 AM
    USE AdventureWorks;
    GO
    SELECT Resume.query
    N'//*:Name.First,
    //*:Name.Middle,
    //*:Name.Last,
    //*:Edu.Level
    FROM HumanResources.JobCandidate;
    I executed this set of Listing 12-9 code in my SQL Server 2012 Management Studio and I got the following error messages:
    Msg 105, Level 15, State 1, Line 4
    Unclosed quotation mark after the character string '//*:Name.First,
    //*:Name.Middle,
    //*:Name.Last,
    //*:Edu.Level
    FROM HumanResources.JobCandidate;
    Msg 102, Level 15, State 1, Line 4
    Incorrect syntax near '//*:Name.First,
    //*:Name.Middle,
    //*:Name.Last,
    //*:Edu.Level
    FROM HumanResources.JobCandidate;
    I am not able to figure out why I got the error messages.  Please kindly help and advise me how to correct this set of sql codes.
    Thanks in advance,
    Scott Chang

    Hi Scott,
    I don't have that book at hand, but your problem is the "Unclosed quotationmark after the character string",as the error message shows. You have to enclose the 'XQUERY' string quotation in the
    query().
    SELECT jobcandidateid, Resume.query
    N'//*:resume,
    //*:Name.Middle,
    //*:Name.Last,
    //*:Edu.Level' --enclose the quotation here
    FROM HumanResources.JobCandidate;
    For XQUERY learning, here is a good
    link.
    If you have any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • Please help with a query

    select * from testme;
    NAME VAL
    A 1
    A 2
    A 3
    B 1
    B 2
    B 3
    C 1
    C 2
    I want to get the maximum of name and the maximum of corresponding name's value.
    ie., the answer should be
    Name VAL
    C     2
    Please help me with the query.
    Thnx

    SQL> create table testme
      2  as
      3  select 'A' name, 1 val from dual union all
      4  select 'A', 2 from dual union all
      5  select 'A', 3 from dual union all
      6  select 'B', 1 from dual union all
      7  select 'B', 2 from dual union all
      8  select 'B', 3 from dual union all
      9  select 'C', 1 from dual union all
    10  select 'C', 2 from dual
    11  /
    Tabel is aangemaakt.
    SQL> select max(name) name
      2       , max(val) keep (dense_rank last order by name) val
      3    from testme
      4  /
    NAME VAL
    C      2Regards,
    Rob.

Maybe you are looking for