Select *, rowid into var1, var2 from...

Hello,
as mentioned in the subject, I want to do the following in plsql:
var1 table%rowtype;
var2 rowid;
select *, rowid into var1, var2 from table where ...;
So this is not possible yet, what else can I do instead as I ...
1. don't want to split one select statement into two.
2. don't know the columns of the table at compile time.
3. would like to use the rowtype, if possible.
Any ideas?
Thanx a lot
Matthias

If you do not know the columns at compile-time then how is your update-statement working? Is that getting generated dynamically too? And are your updating all the columns in the table?
PS: Btw, you can declare a cursor and have a %rowtype variable based on that. Like this:
declare
    cursor c1
    is
    select t.*,
           t.rowid
    from   table1  t
    r_cursor     c1%rowtype;
begin
    for r_cursor in c1
    loop
        dbms_output.put_line ( 'Col2: [' || r_cursor.col2 || ']' );
        update table1
        set    col2 = r_cursor.col2 + 10
        where  table1.rowid = r_cursor.rowid
    end loop;
end;
/

Similar Messages

  • Selecting values into same internal table from 2 differrnt select statement

    Hi Friends,
    code :
    types :
       begin of ty_bsad,
         augbl type bsad-augbl,
      end of ty_bsad.
    begin of ty_bsad1,
         augbl type bsad-augbl,
         belnr type bsad-belnr,
      end of ty_bsad1.
      select augbl
               from bsad
              into table it_bsad
              where belnr = l_vbeln and
                       bukrs = l_bukrs and
                      kunnr  = l_kunrg.
           if sy-subrc = 0 .
               select belnr
                         into table lt_bsad1
                         from bsad
                        for all entries in lt_bsad
                       where augbl = lt_bsad-augbl and
                                kunnr = l_kunnr  and
                                burks  = l_bukrs and
                                blart   = 'xy'.
    now my requiremnt is i need to get both the augbl and belnr in single internal table but not in differnrnt internal table.
    how can i get it.
    Regards,
    Priyanka.
    Code Formatted by: Alvaro Tejada Galindo on Jan 8, 2009 10:53 AM

    HI.
    No Need to create two internal table because your feyching values from same table BSAD with diffrent where condition.try this code.it s work.
    select augbl
    from bsad
    into table it_bsad
    where belnr = l_vbeln and
    bukrs = l_bukrs and
    kunnr = l_kunrg and
    blart = 'xy'.
    else Refer this code.
    LOOP AT it_bill_data INTO wa_bill_data.
        MOVE-CORRESPONDING wa_bill_data TO wa_final_data.
        READ TABLE it_material_data INTO wa_material_data
                                    WITH KEY matnr = wa_bill_data-matnr.
        IF sy-subrc = 0.
          wa_final_data-meins_mara = wa_material_data-meins.
        ENDIF.
        APPEND wa_final_data TO it_final_data.
    ENDLOOP.
    Regards.
    Jay
    Edited by: Jay on Jan 8, 2009 2:53 PM
    Edited by: Jay on Jan 8, 2009 2:57 PM
    Code Formatted by: Alvaro Tejada Galindo on Jan 8, 2009 10:56 AM

  • ORA-01446 when selecting ROWID from View with Union

    I have a View that uses a Union to select from 3 tables. I would like the View to return the ROWID for the record that is returned so that I can update it in my form. The View compiles fine but when I select from the View I get ORA-01446 error.
    Example of my view:
    SELECT ROWID, col_a, col_b, col_c
    FROM tab_a
    UNION ALL
    SELECT ROWID, col_a, col_b, col_c
    FROM tab_b
    UNION ALL
    SELECT ROWID, col_a, col_b, col_c
    FROM tab_c
    I need the ROWID because my tables do not contain UNIQUE/PRIMARY key constraints. In my form I want to update the view with an underlying INSTEAD OF database trigger.
    Any suggestions?

    I think it will work if you give the column an alias (ie a name after the first rowid) and select that instead.
    You will probably also need another column in your view indicating which table the row came from if you want to update it.

  • Tabular form on a view :ORA-01446: cannot select ROWID from, or sample...

    Hi,
    I have two tables
    CUSTOMERS
    ===========
    Name Null Type
    ======================
    CUST_UID NOT NULL NUMBER(4)
    CUST_NAME VARCHAR2(50)
    ITEM_PRICES
    ===========
    Name Null Type
    ======================
    IP_UID NOT NULL NUMBER(4)
    IP_ITEM_DESC VARCHAR2(50
    IP_COST_PRICE NUMBER(6,2)
    IP_SELL_PRICE NUMBER(6,2)
    I have a view IPS_VW which is the cartician product of CUSTOMERS and ITEM_PRICES, and an instead of trigger for UPDATE on this view which either inserts or updates data in the following third table
    ITEM_PRICES_SPECIAL
    ===========
    Name Null Type
    ======================
    IPS_UID NOT NULL NUMBER(4)
    CUST_UID NUMBER(4)
    IP_UID NUMBER(4)
    IPS_SELL_PRICE NUMBER(6,2)
    The following is my view
    SELECT 'A'||ROWNUM AS "IPSVW_UID",
    0 AS "IPSVW_IPS_UID",
    "CUSTOMERS"."CUST_UID" AS "IPSVW_CUST_UID",
    "ITEM_PRICES"."IP_UID" AS "IPSVW_IP_UID",
    "ITEM_PRICES"."IP_SELL_PRICE" AS "IPSVW_IPS_SELL_PRICE"
    FROM "CUSTOMERS" "CUSTOMERS",
    "ITEM_PRICES" "ITEM_PRICES"
    WHERE NOT EXISTS
    (SELECT 1
    FROM "ITEM_PRICES_SPECIAL" "ITEM_PRICES_SPECIAL"
    WHERE "ITEM_PRICES_SPECIAL"."IP_UID" ="ITEM_PRICES"."IP_UID"
    AND "ITEM_PRICES_SPECIAL"."CUST_UID" ="CUSTOMERS"."CUST_UID"
    UNION
    SELECT 'B' ||ROWNUM AS "IPSVW_UID",
    "ITEM_PRICES_SPECIAL"."IPS_UID" AS "IPSVW_IPS_UID",
    "ITEM_PRICES_SPECIAL"."CUST_UID" AS "IPSVW_CUST_UID",
    "ITEM_PRICES_SPECIAL"."IP_UID" AS "IPSVW_IP_UID",
    "ITEM_PRICES_SPECIAL"."IPS_SELL_PRICE" AS "IPSVW_IPS_SELL_PRICE"
    FROM "ITEM_PRICES_SPECIAL" "ITEM_PRICES_SPECIAL";
    And this is the instead of trigger
    CREATE OR REPLACE TRIGGER "TRG_IPSVW_UPDATE" INSTEAD OF
    UPDATE ON IPS_VW REFERENCING NEW AS N FOR EACH ROW
    BEGIN
    IF :N.IPSVW_IPS_UID = 0 THEN
    INSERT INTO ITEM_PRICES_SPECIAL
    ( CUST_UID, IP_UID,IPS_SELL_PRICE )
    VALUES
    ( :N.IPSVW_CUST_UID,:N.IPSVW_IP_UID, :N.IPSVW_IPS_SELL_PRICE );
    ELSE
    UPDATE ITEM_PRICES_SPECIAL
    SET IPS_SELL_PRICE = :N.IPSVW_IPS_SELL_PRICE
    WHERE IPS_UID = :N.IPSVW_IPS_UID;
    END IF;
    END;
    Everything works fine in SQLPLUS, if i update a rate in this view, a record is either inserted or updated in the third table.
    But when i try to create a tabular form based on this view, i get the error
    ORA-01446: cannot select ROWID from, or sample, a view with DISTINCT, GROUP BY, etc.
    Could someone help me please?
    Thanks,
    Allen

    I think The tabular form needs to be able to identify some primary key and using a rownum concatenation cannot provide that.
    Cheers
    Kofi

  • Cannot select ROWID from, or sample, a join view without a key-preserve

    I'm getting an error "cannot select ROWID from, or sample, a join view without a key-preserved table" when performing an INSERT. There is no error when performing an UPDATE.
    I created a "Form with Reports" page, where the Reports is based on a view multi table join. The primary key I chose during the form creation process is "From Trigger". The primary key "ACCESS_ID" has been defined in the base table. On the view, I have created an INSTEAD OF TRIGGER, for both Insert and Update. The update seems to work. I am using the automatic row processing for the update and insert.
    Additional information: My insert works standalone i.e. i write
    insert into jxjplntr_access_v (col1, ...)
    values (va1, val2...)
    and it works when i run it on SQL window.
    access_id has a constraint defined as not null and also PK.
    I have an insert "instead of" trigger defined on the jxjplntr_access_v view.
    However, when i "CREATE" a record after filling in the values, I get the above error. BTW, here is the view definition:
    CREATE OR REPLACE VIEW jxjplntr_access_v (
    access_id,
    person_id,
    person_name,
    badge_number,
    ntr_resp_type,
    primary_flag,
    start_date_active,
    end_date_active,
    created_by,
    created_by_uname,
    creation_date,
    last_updated_by,
    last_updated_by_uname,
    last_update_date,
    last_update_login )
    AS
    select
    access_id,
    ja.person_id,
    initcap(p.last_name||', '||p.first_name) person_name,
    p.employee_number badge_number,
    ntr_resp_type,
    primary_flag,
    ja.start_date_active,
    ja.end_date_active,
    ja.created_by,
    f1.user_name created_by_uname,
    ja.creation_date,
    ja.last_updated_by,
    f2.user_name last_updated_by_uname,
    ja.last_update_date,
    ja.last_update_login
    from jplntr.jplntr_access ja
    ,fnd_user f1
    ,fnd_user f2
    ,per_people_x p
    where f1.user_id(+) = ja.created_by
    and f2.user_id(+) = ja.last_updated_by
    and p.person_id(+) = ja.person_id
    Thanks in advance.
    K
    Edited by: kktong on Dec 12, 2011 5:39 PM
    Edited by: kktong on Dec 13, 2011 10:06 AM

    I've just been looking at exactly the same problem. From my initial investigations, this seems to be a bug with Apex and creating a tabular form, as described in this thread here:
    v4.0 - Tabular form ORA-01445: cannot select ROWID from, or sample,
    Very frustrating!
    I hope thats of use to you. If I find out anything else, I'll come back and let you know.
    Simon
    Edited by: Simon Holt on 26-Jul-2012 03:32

  • " ORA-01445: cannot select ROWID from, or sample, a join view without a key

    GREETINGS !
    CREATED TABULAR FORM WITH QUERY
    WHILE EXECUTE ON SQL COMMANDS ITS EXECUTES AND SHOWS RECORDS, PASTE SAME QUERY ON TABULAR FORM SOURCE . WHEN RUN PAGE IT GIVES ERROR
    " ORA-01445: cannot select ROWID from, or sample, a join view without a key-preserved table".
    Edited by: Omzz on Oct 3, 2012 10:34 PM

    When setting the tabular form, only use the table that you are trying to update/modify.
    After that is working, modify the SQL source with the other tables.
    By just pasting an SQL query into the region source, it doesnt know what tables you are trying to update
    PS - Please turn off "Caps Lock" :-)

  • ORA-01445 : cannot select rowid from a join view without a key preserved ta

    Hi,
    I am using Designer6i for generatin forms:
    my blokc is based on a view...
    when executing the module, I have the following error when trying to change a value of an item :
    FRM 40501: unabe to reserve record for update or delete ,
    the display error say :
    ORA-01445 : cannot select rowid from a join view without a key preserved table!!!!!
    Any help please ???

    you either create an INSTEAD OF trigger for that view or use on-lock trigger on that block to edit, e.g., SELECT ...INTO...FROM...WHERE...FOR UPDATE NOWAIT.

  • ORA-01446: cannot select ROWID from, or sample, a view with DISTINCT, GROUP BY, etc.

    Dears,
    i have this problem after i create tabular from depend on view
    ORA-01446: cannot select ROWID from, or sample, a view with DISTINCT, GROUP BY, etc.
    this a query that i use
    select
    "INVOICE_DET",
    "INVOICE_DET" INVOICE_DET_DISPLAY,
    "INVOICE_ID",
    "STORAGE_CODE",
    "ITEM_QNTY",
    "ITEM_PRICE",
    "BONS_QNTY",
    "DISC_VALUE",
    "TOT_VAL",
    "LOCATION_CODE",
    "BATCH_DET",
    "ITEM_CODE",
    "ITEM_NAME",
    "UOM_CODE",
    "UOM_NAME",
    "SIZE_CODE",
    "SIZE_NAME",
    "COLOR_CODE",
    "COLOR_NAME",
    "STOREG_BRCHAS_BATCHN",
    "EXPR_DATE",
    "PROD_DATE",
    "ITEM_DET_ID"
    from "#OWNER#"."BRCHAS_INVOICE_DET_VIEW"
    this the view i created
      CREATE OR REPLACE FORCE VIEW "RETAIL"."BRCHAS_INVOICE_DET_VIEW" ("INVOICE_DET", "INVOICE_ID", "STORAGE_CODE", "ITEM_QNTY", "ITEM_PRICE", "BONS_QNTY", "DISC_VALUE", "TOT_VAL", "LOCATION_CODE", "BATCH_DET", "ITEM_CODE", "ITEM_NAME", "UOM_CODE", "UOM_NAME", "SIZE_CODE", "SIZE_NAME", "COLOR_CODE", "COLOR_NAME", "STOREG_BRCHAS_BATCHN", "EXPR_DATE", "PROD_DATE", "ITEM_DET_ID") AS
      SELECT invoice_det, invoice_id, storage_code, item_qnty, item_price,
              bons_qnty, disc_value, tot_val, location_code, batch_det, item_code,
              item_name, uom_code, uom_name, size_code, size_name, color_code,
              color_name, storeg_brchas_batchn, expr_date, prod_date, item_det_id
         FROM (SELECT d.invoice_det, d.invoice_id, d.storage_code, d.item_qnty,
                      d.item_price, d.bons_qnty, d.disc_value, d.tot_val,
                      d.location_code, d.batch_det, i.item_code,
                      get_item_name (i.item_code) item_name, i.uom_code,
                      get_uom_desc (i.uom_code) uom_name, i.size_code,
                      get_size_name (i.size_code) size_name, i.color_code,
                      get_color_name (i.color_code) color_name,
                      dd.storeg_brchas_batchn, b.expr_date, b.prod_date,
                      i.item_det_id
                 FROM brchas_invoice_det d,
                      brchas_batch dd,
                      brchas_batch_det b,
                      item_uom_size_color i
                WHERE dd.storeg_brchas_batchinternn = b.storeg_brchas_batchinternn
                  AND d.batch_det = b.batch_det
                  AND b.item_det_id = i.item_det_id
                  AND d.batch_det IS NOT NULL
               UNION ALL
               SELECT d.invoice_det, d.invoice_id, d.storage_code, d.item_qnty,
                      d.item_price, d.bons_qnty, d.disc_value, d.tot_val,
                      d.location_code, d.batch_det, i.item_code,
                      get_item_name (i.item_code) item_name, i.uom_code,
                      get_uom_desc (i.uom_code) uom_name, i.size_code,
                      get_size_name (i.size_code) size_name, i.color_code,
                      get_color_name (i.color_code) color_name,
                      NULL storeg_brchas_batchn, NULL expr_date, NULL prod_date,
                      i.item_det_id
                 FROM brchas_invoice_det d, item_uom_size_color i
                WHERE d.item_det_id = i.item_det_id
                AND d.batch_det IS NULL) ;
      CREATE OR REPLACE TRIGGER "RETAIL"."BRCHAS_INVOICE_DET_VIEW_TRG"
    INSTEAD OF DELETE OR INSERT OR UPDATE
    ON RETAIL.BRCHAS_INVOICE_DET_VIEW
    REFERENCING NEW AS NEW OLD AS OLD
    FOR EACH ROW
    DECLARE
    V_PRICE NUMBER;
    V_BONUS_QNTY NUMBER;
    V_DISC_VAL NUMBER;
    BEGIN
      IF INSERTING THEN
          INSERT INTO BRCHAS_INVOICE_DET
          (INVOICE_DET,
          INVOICE_ID ,
          STORAGE_CODE,
          ITEM_QNTY,
          ITEM_PRICE,
          BATCH_DET,
          BONS_QNTY,
          TOT_VAL,
          LOCATION_CODE,
          DISC_VALUE,
          CREATED_USER,
          CREATED_DATE,
          ITEM_DET_ID
          VALUES
          ("BRCHAS_INVOICE_DET_SEQ".nextval,
          :NEW.INVOICE_ID ,
          :NEW.STORAGE_CODE,
          :NEW.ITEM_QNTY,
          :NEW.ITEM_PRICE,
          :NEW.BATCH_DET,
          :NEW.BONS_QNTY,
          (:NEW.ITEM_QNTY * NVL(:NEW.ITEM_PRICE,0)) - NVL(:NEW.DISC_VALUE,0),
          :NEW.LOCATION_CODE,
          :NEW.DISC_VALUE,
          nvl(v('APP_USER'),user),
          sysdate,
          :NEW.ITEM_DET_ID);
      ELSIF UPDATING THEN
            UPDATE BRCHAS_INVOICE_DET
            SET INVOICE_ID    =:NEW.INVOICE_ID,
                STORAGE_CODE  =:NEW.STORAGE_CODE,
                ITEM_QNTY     =:NEW.ITEM_QNTY,
                ITEM_PRICE    = :NEW.ITEM_PRICE,
                BATCH_DET     =:NEW.BATCH_DET,
                BONS_QNTY     = :NEW.BONS_QNTY,
                TOT_VAL       =(:NEW.ITEM_QNTY * NVL(:NEW.ITEM_PRICE,0)) - NVL(:NEW.DISC_VALUE,0),
                LOCATION_CODE =:NEW.LOCATION_CODE,
                DISC_VALUE    = :NEW.DISC_VALUE,
                ITEM_DET_ID =:NEW.ITEM_DET_ID
            WHERE INVOICE_DET =:NEW.INVOICE_DET;
      ELSE
            DELETE FROM BRCHAS_INVOICE_DET
             WHERE INVOICE_DET =:OLD.INVOICE_DET;
      END IF;
       EXCEPTION
         WHEN OTHERS THEN
           -- Consider logging the error and then re-raise
           RAISE;
    END BRCHAS_INVOICE_DET_VIEW_TRG;
    ALTER TRIGGER "RETAIL"."BRCHAS_INVOICE_DET_VIEW_TRG" ENABLE;
    please i need help
    Thanks
    Ahmed

    Hi,
    This might help
    http://www.techonthenet.com/oracle/errors/ora01446.php
    Regards,
    Jari

  • What causes "ORA-01445: cannot select ROWID from" error

    While executing a SELECT query i got this error:
    ORA-01445: cannot select ROWID from, or sample, a join view without a
    key-preserved table
    Below mentioned is the join condition part of the query. The line which the error has occured is italicized
    from checkout_hdtl ch
    inner join pmt_htl ph on ph.post_ln_a = ch.post_ln_code
    inner join pin_dls pd on pd.post_ln_a = ph.post_ln_code
    inner join carton_dtl cd on cd.carton_nbr = ch.carton_nbr
    and cd.lseq_nbr = pd.lseq_nbr
    inner join invoice_module im on cd.invevt_code = im.inv_code
    inner join item_dock_master del on nm.invent_code = iwm.inv_code
    left outer join inv_curr_comm_code mnb on ium.invent_code = im.inv_code
    and icc.cntry = ph.shipto_cntry
    left outer join vw_ver_master vw on vw.del_rec = ch.del_rec
    left outer join cmd code_entry on code_pi.cntry =
    cd.code_entry where ch.shpmt_nbr = '3'
    What do i do?

    I would rather use Notepad than store my data in SQL server. It just so happens that our product is released for SQL Server as well. Hence i did the testing.
    >Is there a limit to the number of joins that can be performed in Oracle?
    Wrong question as it does not have anything to do with the number of views.. it has everything to do with the ability to correctly identify the unique row. Re-read the error message details posted by Blu - it explains the error.As you can see from my post, i created a table using the(CTAS) SELECT query from the View vw_ver_master's definition. So the view's result set is now stored in a table and now there are only tables involved in these JOINS.
    The query will succeed if i comment out ANY one of these JOINS in this statement. This is so weird.
    I

  • ORA-01445: cannot select ROWID from, or sample, a join view without a key-p

    Hi All,
    I am facing issue with one sql query. It is giving me error:
    ORA-01445: cannot select ROWID from, or sample, a join view without a key-preserved table
    I am not getting any clue to solve this. On internet, i didn't find proper reason for this error and troubleshooting way and solution for this error. Everywhere i saw one sentence, "Key preserved means the row from the base table will appear AT MOST ONCE in the output view on that table" but it didn't solve my problem.
    I have 1099 columns in one select query. so avoiding the actual column list in select clause. Instead I am trying to select ROWIDs from all tables in join. My understanding is ROWID is a unique identifier in table not in database. But though I remove ROWIDs, I get same error. So please don't bother about these ROWIDs.
    SELECT
    TO_DATE(FACT.BUS_DATE_FKID,'YYYYMMDD')
    ,FACT.ROWID AS ABC1
    ,FACT_ADJ.ROWID AS ABC2
    ,DIM_SEC.ROWID AS ABC3
    ,DIM_SEC_ADJ.ROWID AS ABC4
    ,DIS_CAT.ROWID AS ABC5
    ,CTRY.ROWID AS ABC6
    ,BCP.ROWID AS ABC7
    ,STAGE.ROWID AS ABC8
    FROM FACT_POSITION FACT
    LEFT JOIN FACT_POSITION_ADJ FACT_ADJ ON FACT.POSITION_PKID = FACT_ADJ.POSITION_FKID
    LEFT JOIN DIM_SOURCE_SYSTEM SOURCE ON FACT.SOURCE_SYSTEM_FKID = SOURCE.SOURCE_SYSTEM_PKID
    LEFT JOIN DIM_SECURITY DIM_SEC ON FACT.SUBSYS_SECURITY_FKID = DIM_SEC.SECURITY_PKID
    LEFT JOIN DIM_SECURITY_ADJ DIM_SEC_ADJ ON FACT.SUBSYS_SECURITY_FKID = DIM_SEC_ADJ.SECURITY_PKID
    LEFT JOIN DIM_DISCLOSURE_CATEGORY DIS_CAT ON FACT.DISCLOSURE_CATEGORY_FKID = DIS_CAT.DISCLOSURE_CATEGORY_PKID
    LEFT JOIN COUNTRY_REFERENCE CTRY ON CTRY.DESCRIPTION = DIM_SEC.ISSUER_COUNTRY
    LEFT JOIN BUSINESS_CLOSE_PERIOD BCP
    ON BCP.BUSINESS_CLOSE_DATE = ADD_MONTHS(TRUNC(TO_DATE(FACT.BUS_DATE_FKID,'YYYYMMDD'),'MM'), 1) -1
    AND BCP.IS_LOCKED='Y' AND BCP.IS_ACTIVE='Y'
    LEFT JOIN GUI_STAGING STAGE ON
    FACT.POSITION_PKID=STAGE.POSITION_PKID
    AND STAGE.IS_ACTIVE='Y'
    AND STAGE.STATUS_ID IN(12,8,1,2,3,4,5)
    WHERE FACT.POSITION_PKID=64524374;
    While trying to sort this error, I found interesting things that made me more confused.
    if I remove TO_DATE function from select clause, same join query works.
    If I remove any table from join and keep TO_DATE function in select clause, query works.
    That tells, there is no problem in query.
    Then please anyone help me to sort out the error. FYI. I have googled a lot for this error. but didn't get solution/clue. That is why I am posting this problem to forum.
    Thanks in advance. waiting for reply ASAP.
    Pravin Pujari
    [email protected]

    I think i got the solution. The syntax i was using (ANSI syntax) doesn't work in the oracle database version i am using.
    When i updated my query with older oracle syntax, it worked.
    SELECT
    TO_DATE(FACT.BUS_DATE_FKID,'YYYYMMDD')
    ,FACT.ROWID AS ABC1
    ,FACT_ADJ.ROWID AS ABC2
    ,SOURCE.ROWID AS ABC3
    ,DIM_SEC.ROWID AS ABC4
    ,DIM_SEC_ADJ.ROWID AS ABC5
    ,DIS_CAT.ROWID AS ABC6
    ,CTRY.ROWID AS ABC7
    ,BCP.ROWID AS ABC8
    ,STAGE.ROWID AS ABC8
    FROM [email protected] FACT
    ,[email protected] FACT_ADJ
    ,[email protected] SOURCE
    ,[email protected] DIM_SEC
    , [email protected] DIM_SEC_ADJ
    , [email protected] DIS_CAT
    , GUI.COUNTRY_REFERENCE CTRY
    , GUI.BUSINESS_CLOSE_PERIOD BCP
    , GUI.GUI_STAGING STAGE
    WHERE FACT.POSITION_PKID=64517140
    AND FACT_ADJ.POSITION_FKID(+) = FACT.POSITION_PKID
    AND SOURCE.SOURCE_SYSTEM_PKID=FACT.SOURCE_SYSTEM_FKID
    AND DIM_SEC.SECURITY_PKID=FACT.SUBSYS_SECURITY_FKID
    AND DIM_SEC_ADJ.SECURITY_PKID(+)=DIM_SEC.SECURITY_PKID
    AND FACT.DISCLOSURE_CATEGORY_FKID = DIS_CAT.DISCLOSURE_CATEGORY_PKID
    AND CTRY.DESCRIPTION = DIM_SEC.ISSUER_COUNTRY
    AND BCP.BUSINESS_CLOSE_DATE = ADD_MONTHS(TRUNC(TO_DATE(FACT.BUS_DATE_FKID,'YYYYMMDD'),'MM'), 1) -1
    AND BCP.IS_ACTIVE='Y'
    AND FACT.POSITION_PKID=STAGE.POSITION_PKID
    AND STAGE.IS_ACTIVE='Y'
    AND STAGE.STATUS_ID IN(12,8,1,2,3,4,5);

  • ORA-03113 when inserting a CLOB value casted as an XMLType from a SELECT query into a table

    I have a table that contains a CLOB column with pseudo-XML in it. I want to keep this data in an XMLType column so that I can leverage some of Oracle's built-in XML features to parse it more easily.
    The source table is defined as:
    CREATE TABLE "TSS_SRM_CBEBRE_LOGS_V"
    ( "INCIDENT_ID" NUMBER,
    "EVENT_TYPE" VARCHAR2(100 BYTE) NOT NULL ENABLE,
    "EVENT_KEY" VARCHAR2(100 BYTE),
    "CREATION_DATE" TIMESTAMP (6) NOT NULL ENABLE,
    "CREATED_BY" VARCHAR2(100 BYTE) NOT NULL ENABLE,
    "LOG_MSG" CLOB);
    The target (for testing this problem) table is defined as:
    CREATE TABLE "TESTME"
    ( "LOG_MSG" "XMLTYPE"
    My query is:
    insert /*+ APPEND */ into testme ("LOG_MSG")
    select XMLTYPE.createXML("LOG_MSG") as LOG_MSG from "TSS_SRM_CBEBRE_LOGS_V" b;
    In SQL*Developer, my error is: Error report:
    SQL Error: No more data to read from socket
    In SQL*PLUS and Toad, my error is:
    ORA-03113: end-of-file on communication channel
    Process ID: 13903
    Session ID: 414 Serial number: 32739

    By pseudo-XML, I mean that it doesn't have the xml root node. The content structure is similar to the following:
    <a attr1="1" attr2="2" />
    <b attr1="3" attr2="4" />
    <c attr1="5">
    <e attr1="6" attr2="7" />
    <e attr1="8" attr2="9" />
    <e attr1="10" attr2="11" />
    </c>
    <d attr1="12" />
    OK. Those are XML fragments then.
    I'm surprised you say the query alone works.
    We cannot build an XMLType instance using the default constructor or createXML() method when the content is composed of fragments.
    AFAIK the only option is to use XMLParse() with CONTENT option :
    SQL> select xmltype.createxml(LOG_MSG) from TSS_SRM_CBEBRE_LOGS_V;
    ERROR:
    ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00245: extra data after end of document
    Error at line 2
    ORA-06512: at "SYS.XMLTYPE", line 5
    no rows selected
    SQL> select xmltype(LOG_MSG) from TSS_SRM_CBEBRE_LOGS_V;
    ERROR:
    ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00245: extra data after end of document
    Error at line 2
    ORA-06512: at "SYS.XMLTYPE", line 272
    ORA-06512: at line 1
    no rows selected
    SQL> select xmlparse(content LOG_MSG) from TSS_SRM_CBEBRE_LOGS_V;
    XMLPARSE(CONTENTLOG_MSG)
    <a attr1="1" attr2="2" />
    <b attr1="3" attr2="4" />
    <c attr1="5">
    <e attr1="6" a
    Anyway, you'll eventually hit this :
    SQL> insert into testme (LOG_MSG)
      2  select XMLparse(content LOG_MSG)
      3  from TSS_SRM_CBEBRE_LOGS_V;
    insert into testme (LOG_MSG)
    ERROR at line 1:
    ORA-19010: Cannot insert XML fragments

  • SELECT FIELD INTO FROM WHERE

    Hello,
    pls. help me to solve the following problem :
    declare
    zsql varchar2(200);
    I_FKART varchar2(4);
    begin
    zsql:='select FKART into';
    zsql:=zsql||'P39_FKART from scmoper.ZUMFA WHERE
    FKART =:P39_INPUT';
    return (zsql);
    end;
    IT WORKS, BUT THE FIELD P39_FKART isn't filled . It shows the value of the table ZUMFA (only one value) in form of list.
    I've tried with :P39_FKART or &P39_FKART. It doesn't work.
    many thanks for your help in advance .
    Tl

    I think it should work when you do it like:
    zsql:=zsql||:P39_FKART||' from scmoper.ZUMFA WHERE
    Oh wait, now I see what you are doing...
    You shouldn't do the select INTO in the buildup of your dynamic sql, but where you use it. I'm not sure of the syntax, but a quick search on Google or the forum should help you along. It should be something like EXECUTE IMMEDIATE zsql INTO :P39_FKART;
    Edited by: Michel van Zoest on Sep 16, 2009 2:53 PM

  • Current_date different in forms 10g (variable:=current_date differente from select current_date into varialble)

    If in a form, I assign current_date to a variable like ' wdate:=current_date' the variable get incorrect value than if i assign like 'select current_date into wdate from dual'
    Why?, current_date is always from database session isn't it?
    Thanks for your help.

    Hello tony.g
    This is the code:
    :b11.femovi is a form field date type;
    In this code wdate shows differente value than :b11.femovi.
    I think that the value must be the same because "current_date" is a database variable isn't it?
    declare
    wdate date;
    begin
    :b11.femovi := current_date;
    select current_date into wdate from dual;
    rutmensaje('date='||to_Char(wdate,'dd/mm/yyyy hh24:MI')||'-'||to_Char(:b11.femovi,'dd/mm/yyyy hh24:MI'));
    end;

  • Insert items from two different Multiple Select Lists into a single table

    I need help. I have a training tracking system that tracks the courses taken by employees.
    I have created two multiple select lists, one is SelectEmployees and the other is SelectCourses. I want to insert
    the selected item from those two multiple select lists into Training_Record table.
    Note, SelectEmployees" is from Employee table and SelectCourses is from Courses table. Those two table has no intersetion.
    Train_Record is the table that joins those two together.
    Please advice and your help is appreciate.

    Thank you for your help.
    I tried your code and changed the table/field name to my actual table/field name and the iitem name to actual item name.
    declare
    cursor c_Employees is
    select PERSONNEL_NEW.EMPLOYEEID from PERSONNEL_NEW where PERSONNEL_NEW.EMPLOYEEID in (:P15_SELECTEDEMP);
    cursor c_Courses is
    select COURSES.COURSE_ID from COURSES where COURSES.COURSE_ID in
    (:P15_SELECTEDCOUR);
    begin
    foreach :=r_employee in c_Employees loop
    foreach :=r_course in c_Courses loop
    insert
    into COPYOFTRAINREC ( EMPLOYEEID, COURSEID )
    values ( r_employee.EMPLOYEEID, r_course.COURSE_ID );
    end loop;
    end loop;
    end;
    I got error message as :
    ORA-06550: line 12, column 25: PLS-00103: Encountered the symbol "C_EMPLOYEES" when expecting one of the following: (
    Error
    OK

  • How to select rowid with select * from table_name

    Hello guys i have a cursor like so.
      Cursor c1 IS SELECT * FROM FZRASST;
      -- Row of type FZRASST row
      fzrasst_row c1%ROWTYPE;when i try to reference the row id like this
    fzrasst_row.rowid;i get an error invalid indentifier? how can i reference the row id without implicitely selecting rowid? is this possible or do i need to change my select statement to select every column on the table?
    Any help would be greatly appreciated.

    Hi,
    mlov83 wrote:
    Hello guys i have a cursor like so.
    Cursor c1 IS SELECT * FROM FZRASST;
    -- Row of type FZRASST row
    fzrasst_row c1%ROWTYPE;when i try to reference the row id like this
    fzrasst_row.rowid;i get an error invalid indentifier? how can i reference the row id without implicitely selecting rowid? is this possible or do i need to change my select statement to select every column on the table?Fzrasst_row contains every column that is in the SELECT clause, and nothing more. If you want fzrasst_row to include pseudo-columns (such as ROWID) or anything else, then you have to include them in the SELECT clause.
    To avoid naming every single column in hte table, you can do something like this:
    Cursor c1 IS
        SELECT  FZRASST.*
        ,       ROWID   AS r_id
        FROM    FZRASST;(assuming the table doesn't already have a column called r_id).
    Edited by: Frank Kulash on Feb 13, 2012 3:29 PM

Maybe you are looking for

  • Print multiple copies of a smartforms in a one spool request

    Dear all, I've a network printer "HP Laserjet 4250" configured with an output accessory "Sheet Stapler/Stacker". With these accessory all pages of the same spool are stapled together. For transaction VL02N we would print n copies of the same delivery

  • Why does dying internal hard drive stop you booting from external hd

    Why do I need an internal hard drive if I am booting from an external drive? Doesnt make sense, Disk Utility warned me that the internal hard drive is failing. I have managed to change start up disks. I have an external bootable drive and even have a

  • How to restore backed up files off DVD onto my PC?

    This mornign my PC wouldn't switch on. said it had to repair itself. Finally said it couldn't. So I backed up using the HP backup program. I now have 7 DVDs of my backed-up, zipped files. I have restored my PC to factory settings and now want to relo

  • Install PI 7.1 on iSeries

    Hi ALL I'm currently trying to install PI 710 on AS/400, but it seems TMKSVR is not supported in this new version. As mentioned in installation guide, is it mandatory to have a X window server for sapinstGUI? Is there an alternative for that, like re

  • Ipod lags or freezes whenever I play music.

    Okay, I'm having such a hard time with my Ipod Classic 80g. When ever I play music, my Ipod Lags and I dont mean a second or two, I mean like 10-15 second at leats or even longer. And to top that off, whenever I Try to play music, it drains my batter