Update using 2 tables

Hello

MAIN_TABLE

ID_COL
Col1 Col2 HASH_CODE
1AAABBBAAXXXEHYEYEL
2CCCDDDWSKLWEIEKEW
3EEEFFFWLKSPPSKEKE
4GGGHHHWEWEWLWJEK

STG_TABLE

ID_COL Col1 Col2 HASH_CODE
1AAABBBAAXXXEHYEYEL
2CCCCEFASDFWERWER
3EEESDEWERSDFWERW
4GGGHHHWEWEWLWJEK

A primary key on MAIN_TABLE is ID_COL. I generate HASH_CODE using COL1 and COL2.

I'm trying to update MAIN_TABLE using STG_TABLE using fields: ID_COL and HASH_CODE. Can anyone help me please with the query. The resulting data in MAIN_TABLE must be the same as STG_TABLE.

Oracle version:

Oracle Database 11 g Enterprise Edition Release 11.1.0.7.0 - 64 bit Production

PL/SQL Release 11.1.0.7.0 - Production

CORE Production 11.1.0.7.0

AMT for Linux: Version 11.1.0.7.0 - Production

NLSRTL Version 11.1.0.7.0 - Production

Operating system: Windows7

Hi Vpolasa,

I suggest you use the merge statement to satisfy this requirement.

On a conditional basis of two table one is the staging another production.

Hope below mentioned piece of code can illustrate the basic outline for the solution.

MERGE INTO TMP_FK  B
 USING TMP_PK A
 ON (A.ID =B.ID
    AND HASH_PROD<>HASH_STAGING)
 WHEN MATCHED THEN
 UPDATE SET B.UPDATED_COL=HASH_STAGING
CREATE TABLE SICDEV.TMP_PK
(
  ID            NUMBER,
  HASH_STAGING  VARCHAR2(2000 BYTE)
);
Insert into TMP_PK
   (ID, HASH_STAGING)
 Values
   (1, 'c');
COMMIT;
CREATE TABLE SICDEV.TMP_FK
(
  ID           NUMBER,
  HASH_PROD    VARCHAR2(20 BYTE),
  UPDATED_COL  VARCHAR2(20 BYTE)
);

Insert into TMP_FK
   (ID, HASH_PROD, UPDATED_COL)
 Values
   (1, 'q', null);
COMMIT;

Kind regards

Prashant da Silva

Tags: Database

Similar Questions

  • Update using multiple tables

    I'm sorry for this stupid question. I know it's easy to do, and I tried to search through a search, but does not understand how to do it.

    I'm trying to understand how in Oracle everything that I've done in MS Access for many years.

    I need to update a column in a table with data from a column in another table.

    In Access, I can just make

    Update a.a in b
    where a.link = b.link

    The problem is b.link is unique and a.link is not unique, both in Oracle when I do

    Update one
    a.a value = (select b from b, a where a.link = b.link clause)

    I get the error "row subquery returns more than one line.

    I don't know if I need the place where is the clause, but adding, I still get the same error. I also have the same error if I do a select distinct.

    Can someone help me?

    Hello

    You can try this

    Update a SET = AA (select b b where a.link = b.link)

    Thank you

  • GPF using the Table control

    Hello world

    We use a table control to display the log files. Each row of the table represents a log file entry. In addition to that we have put in place

    Some filter chopsticks (string tonalite) to speed up filtering. This means that only the entries corresponding to these substrings are shown. So whenever the filter options

    changed to renew the contents of the table.

    This is done by DeleteTableRows, looking for entries to display, InsertTableRows and SetTableCellRangeVals.

    It works very well.

    But if we remove all the contents of the table (caused by the filter options) and then hit a button (even if the focus is on the table) you get a GPF on ProcessSystemEvents.

    This occurs only after inserting a large number of rows in the table before deleting all the. For example, a table with 5000 x 2 (rowsxcolumns) reduced to 0x2.

    1 create a table with 5000 x 2 (rows x columns) control elements.

    2 remove all lines

    3. press tab until the control panel to get the focus.

    4. hit Enter for example

    => Crash

    Someone has an idea? We have already 'dimmed' CTRL, but this is not enough to avoid that the focus on the table by pressing the tab key. So, which leads to an accident as well.

    Thanks for the help

    Philipp

    Yes, it is a known issue (396240), although it is not actually on time last updated known issues. Unfortunately there is no good solution, other than just by waiting for a version corrected to be released, which should happen soon.

    Luis

  • Where we use lookup table?

    Hello

    Where we use lookup table?

    Thank you

    POOJA

    Hi Pooja,

    Look up table stores data. Look up table data is automatically updated with other data.

    It is used in the "update rule". Look up table has two columns, one for the original values for the changed values.

    Here is a link where you can get more help on implementing of lookup table:

    "If this, then that"-a Guide to create Lookup Tables in Eloqua

    The link "update rule:

    How to run an update rule set with a Table of choice on a shared list

    I hope this helps.

    Kind regards

    Eloqua Experts Edynamic

  • Can I get the total number of records that meet the conditions of a query using the Table API?

    Hello

    A < row > TableIterator is returned when I ask operations using the index of tables. If I want to get the total number of records, I count one by one using the returned TableIterator < row >.


    Can I get the total number of records directly meets the conditions of the query?

    I can get the total number of records directly the request of the meeting of the conditions of CLI using the command Global table - name tableName - count - index index-name-field fieldName - start startValue-end endValue.

    Can I get the same results using the Table API?

    I used MongoDB and NoSQL Oracle for about a year. According to the experience of the use of these dbs, I think mongoDB querying interface is powerful. In the contras, the query interface is relatively simple, which results is a lot of work that is usually a long time in the client side.

    Hello

    Counting records in a database is a tricky thing.  Any system that gives you an accurate count of the records will have a hotspot of concurrency on updates, namely the place where the counting is maintained.  Such a count is a problem of performance in addition to competitive access problem.   The problem is even more difficult in a system widely distributed such a NoSQL database.

    The CLI has overall command that counts, but does so by brutal force - iterate keys that correspond to the parameters of the operation.  This is how you must do this within the API.  There is not a lot of code, but you have to write.  You certainly want to use TableIterator TableAPI.tableKeysIterator (), because a key iteration is significantly faster than the iteration of lines.  Just one iteration and count.

    If you use TableAPI.multiGet () and a key with a touch of brightness full then, in fact, count the results as they are returned in a single piece (a list).

    Kind regards

    George

  • I get "failed to set the refresh attribute COMMIT for the materialized view" when I try to create a MV using a table and another MV

    Experts,

    I'm trying to create a YOUNG refreshable ON COMMIT MV (xyz) using a table (circuit) and quickly updateable on validation MV (abc), but get an error:

    SQL error: ORA-12054: cannot set the attribute ON COMMIT refresh for the materialized view

    12054 00000 - "cannot set the refresh attribute COMMIT for the materialized view.

    * Cause: The materialized view did not meet the requirements for update to

    moment of validation.

    * Action: Specify only valid options.

    1] MV abc
    = MV abc defined as below =.

    CREATE MATERIALIZED view abc_MV

    Immediate CONSTRUCTION

    REFRESH QUICKLY YOU COMMIT using constraints of trust

    WITH ROWID AS SELECT n.*,.

    n.ROWID noderowid

    node n

    where n.nodetype in (1610000069,1610007267);


    -Above works OK and MV connect you on table node is created successfully

    =====================================================

    [ 2] Circuit Board

    ======================================================

    CREATE MATERIALIZED VIEW LOG ON Cramer.Circuit WITH SEQUENCE, ROWID ( ) -all columns of table ofcircut parentheses

    INCLUDING THE NEW VALUES;

    -More top works OK and MV connect you on table circuit is created successfully

    ======================================================



    [3] trying to create MV xyz

    ======================================================

    CREATE MATERIALIZED VIEW LOG ON cramer.abc_MV WITH SEQUENCE, ROWID ( ) -all columns of abc_MV brackets

    INCLUDING THE NEW VALUES;

    -Above works OK and log on ABC MV MV gets created successfully

    -Problematic step below

    Xyz_MV CREATE MATERIALIZED VIEW

    IMMEDIATE CONSTRUCTION

    REFRESH QUICKLY YOU COMMIT using constraints of trust

    AS

    SELECT c., c.rowid circuit_rowid, n.rowid tr_rowid

    the circuit c, abc_mv n

    where circuit2startnode = n.nodeid

    and c.rpplanId = n.rpplanId;
    ==========================================================

    Clues on how to solve this problem and make quickly updatable ON Commit MV xyz

    Thanks in advance.

    Chanchal,

    If you can read my original post carefully you may have noticed that all these restrictions will not apply in my case.

    All,

    In any case I found the solution to my problem.

    There are a few additional restrictions for materialized views multilayer

    Additional Restrictions for master materialized views

    The following types of materialized views may not be masters of editable materialized views:

    • ROWIDmaterialized views
    • Complex materialized views
    • Read-only materialized views

    I've updated the underlying MV abc below and everything worked like a charm

    CREATE MATERIALIZED view abc_MV

    Immediate CONSTRUCTION

    REFRESH QUICKLY YOU COMMIT using constraints of trust

    IN SELECT

    n.*, n.rowid noderowid, nt.rowid nodetyperowid

    the node n, nodetype_m nt

    where n.node2nodetype = nt.nodetypeid

    and nt.nodetypeid in (1610000069,1610007267);

    Note: To ADD a join without which I was getting error below (although had primary key on the table of the node)

    SQL error: ORA-23415: materialized view log for "NODE" does not save the primary key

    23415 00000 - "view the log for materialized \"%s\".\"%s\"does not save the primary key.

    * Cause: A primary key materialized view is refreshed quickly, but the

    The materialized view log does not record the primary key information.

    * Action: Use CREATING MATERIALIZED VIEW LOG... Command to add a PRIMARY KEY to

    start recording of the primary key information in the materialized view

    Newspaper.

  • Can we do a direct update on fnd_concurrent_programs table

    Hi team,

    Can someone help me with this.

    I have a requirement where I need to put the print_flag = "n" for all concurrent programs including Pavilion printer is "O".

    to do this, can I use a direct update statement or is there a standard API to update the column in the fnd_concurrent_programs table.

    My update statement:

    Update fnd_concurrent_programs set print_flag = ' no where print_flag = 'Y ';

    Can I go ahead with above the sql statement to update or do I need to use the api.

    at the same time I just want to check, can I do a direct update on fnd_concurrent_requests table too?

    Can someone help me on this.

    Can I go ahead with above the sql statement to update or do I need to use the api.

    at the same time I just want to check, can I do a direct update on fnd_concurrent_requests table too?

    Yes you can, for the two tables.

    Here are some examples:

    For FND_CONCURRENT_PROGRAMS:

    (Doc ID 419432.1)

    (Doc ID 427963.1)

    (Doc ID 837615.1)

    For FND_CONCURRENT_REQUESTS, see (Doc ID 134007.1).

    Thank you

    Hussein

  • Updated hierarchical attribute table

    I have a hierarchical table called menus. As you can see he ara two branches (63 and 64) that depend on branch 7:

    SELECT id, pid, access by order of menus in 2.1;
    PID ID access
    1-0-3
    2 0 3
    7-2-1
    1-7-63
    1 7 64

    I want to update access for 63 and 64 branches, if I change the access of their parent branch. Lets say I change plug Access 7-0, then branches 63 and 64 should update its access level 0.

    I tried this in a trigger to update after:
    create or replace
    TRIGGER "SISTEMAS". "" MENU_BU ".
    after update to access on "MENUS".
    for each line
    Start
    If: new. "" ACCESS "! =: old. "' ACCESS ' then
    update of the set MENUS ACCESO =: new. ACCESO
    where id in (select id from (select id, the nest of the menus
    connect by prior id = pid
    Start with pid =:old.id));
    end if;
    end;

    If I get an Ora-04088. What I am doing wrong? And what would be the best way to do this?

    What I am doing wrong

    With the help of a trigger and in addition using UPDATE to update at the same table in a trigger

    And what would be the best way to do this?

    Use a stored procedure that performs all the updates you need. Call this stored procedure instead of issuing a direct update against the table.

  • How can improve on the slow update using the query / * + NO_XML_DML_REWRITE * /?

    We have an update query recently brought to my attention that turns very slowly on Oracle 11.2.0.1 against a secure XML binary files table using

    Update / * + NO_XML_DML_REWRITE * / set object_value = croutreach.action: 1 where actn_id =: 2.
    I am told the majority/close to the majority of the ~ 16 fields are updated. This table has also many predefined virtual columns with index fn based on them.

    My first inclination was to this redesign using updatexml Oracle. I was told, the / * + NO_XML_DML_REWRITE * / index would also be required here.

    Update / * + NO_XML_DML_REWRITE * /.
    < tble_name > a
    Set a.object_value = updatexml (a.object_value...).

    Last year our dba have been mandated by Oracle Support to use this trick, as the update has not been updated off any msgs of error records.

    + 1. Hoping to find out if anyone met with this indication in some capacity and what has their experience been? +

    Trying to optimizie this update statement, I'll start from scratch is not using the / * + NO_XML_DML_REWRITE * / hint and will take effect in using the updatexml with establishing a xmlindex.

    + 2. Hoping to receive suggestions on creating the good xmlindex - find an informal index. If getting a few good performance with the xmlindex; in an attempt to remove some of the use of the virtual column. +

    + 3. Any suggestions on living with virtual columns in conjunction with xmlindexes? See the definition of table action and Associates ivirtual columns and indexes. This picture seems more indexed... +.
    REATE
      TABLE "CROUTREACH"."ACTION" OF XMLTYPE
      (
        CONSTRAINT "ACTN_ID_PK" PRIMARY KEY ("ACTN_ID") USING INDEX PCTFREE 10
        INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT
        1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1
        FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE
        DEFAULT) TABLESPACE "ACME_DATA" ENABLE
      )
      XMLTYPE STORE AS SECUREFILE BINARY XML
      (
        TABLESPACE "ACME_DATA" ENABLE STORAGE IN ROW CHUNK 8192 CACHE READS LOGGING
        NOCOMPRESS KEEP_DUPLICATES STORAGE(INITIAL 106496 NEXT 1048576 MINEXTENTS 1
        MAXEXTENTS 2147483645 PCTINCREASE 0 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT
        CELL_FLASH_CACHE DEFAULT)
      )
      ALLOW NONSCHEMA ALLOW ANYSCHEMA VIRTUAL COLUMNS
      (
        *"ACTION_DEF_URN"* AS (CAST(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(XMLQUERY(
        'declare default element namespace "http://www.cigna.com/acme/domains/actions/2010/03"; (::)                                                 
    /action/srvContextPointer/outreachActionDefInfo/@actionDefUrn                                               
    '
        PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
        16777216,0),50,1,2) AS VARCHAR2(50))),
        *"STAT_DT"* AS (SYS_EXTRACT_UTC(CAST(TO_TIMESTAMP_TZ(SYS_XQ_UPKXML2SQL(
        SYS_XQEXVAL(XMLQUERY(
        'declare default element namespace "http://www.cigna.com/acme/domains/actions/2010/03"; (::)                                                              
    /action/@status_dt'
        PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
        16777216,0),50,1,2),'SYYYY-MM-DD"T"HH24:MI:SS.FFTZH:TZM') AS TIMESTAMP
    WITH
      TIME ZONE))),
        *"ACT_DEF_ID"* AS (CAST(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(XMLQUERY(
        'declare default element namespace "http://www.cigna.com/acme/domains/actions/2010/03"; (::)                                                              
    /action/srvContextPointer/outreachActionDefInfo/@actionDefId'
        PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
        16777216,0),50,1,2) AS VARCHAR2(20))),
        *"CORRL_ID"* AS (CAST(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(XMLQUERY(
        'declare default element namespace "http://www.cigna.com/acme/domains/actions/2010/03"; (::)                                                              
    /action/correlationId'
        PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
        16777216,0),50,1,2) AS VARCHAR2(50))),
        *"STAT_RSN"* AS (CAST(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(XMLQUERY(
        'declare default element namespace "http://www.cigna.com/acme/domains/actions/2010/03"; (::)                                                                  
    /action/statusReason'
        PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
        16777216,0),50,1,2) AS VARCHAR2(30))),
        *"ACT_APPNT_DT"* AS (SYS_EXTRACT_UTC(CAST(TO_TIMESTAMP_TZ(SYS_XQ_UPKXML2SQL(
        SYS_XQEXVAL(XMLQUERY(
        'declare default element namespace "http://www.cigna.com/acme/domains/actions/2010/03"; (::)                                                  
    /action/actionAppointment/appointment_dt'
        PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
        16777216,0),50,1,2),'SYYYY-MM-DD"T"HH24:MI:SS.FFTZH:TZM') AS TIMESTAMP
    WITH
      TIME ZONE))),
        *"UPDT_DT"* AS (SYS_EXTRACT_UTC(CAST(TO_TIMESTAMP_TZ(SYS_XQ_UPKXML2SQL(
        SYS_XQEXVAL(XMLQUERY(
        'declare default element namespace "http://www.cigna.com/acme/domains/actions/2010/03"; (::)                                                              
    /action/@update_dt'
        PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
        16777216,0),50,1,2),'SYYYY-MM-DD"T"HH24:MI:SS.FFTZH:TZM') AS TIMESTAMP
    WITH
      TIME ZONE))),
        *"CRET_DT"* AS (SYS_EXTRACT_UTC(CAST(TO_TIMESTAMP_TZ(SYS_XQ_UPKXML2SQL(
        SYS_XQEXVAL(XMLQUERY(
        'declare default element namespace "http://www.cigna.com/acme/domains/actions/2010/03"; (::)                                                              
    /action/@create_dt'
        PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
        16777216,0),50,1,2),'SYYYY-MM-DD"T"HH24:MI:SS.FFTZH:TZM') AS TIMESTAMP
    WITH
      TIME ZONE))),
        *"ACT_SEQ"* AS (CAST(TO_NUMBER(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(XMLQUERY(
        'declare default element namespace "http://www.cigna.com/acme/domains/actions/2010/03"; (::)                                                    
    /action/srvContextPointer/outreachActionDefInfo/@sequence'
        PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
        16777216,0),50,1,2)) AS NUMBER(10))),
        *"SERVICE_DEF_URN"* AS (CAST(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(XMLQUERY(
        'declare default element namespace "http://www.cigna.com/acme/domains/actions/2010/03";                                                          
    /action/srvContextPointer/serviceDefUrn'
        PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
        16777216,0),50,1,2) AS VARCHAR2(100))),
        *"ASSIGN_TEAM_CD"* AS (CAST(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(XMLQUERY(
        'declare default element namespace "http://www.cigna.com/acme/domains/actions/2010/03"; (::)                                                  
    /action/assignment/@teamCategoryCode'
        PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
        16777216,0),50,1,2) AS VARCHAR2(50))),
        *"ASSIGN_STAFF_ID"* AS (CAST(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(XMLQUERY(
        'declare default element namespace "http://www.cigna.com/acme/domains/actions/2010/03"; (::)                                                  
    /action/assignment/staffProfileId'
        PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
        16777216,0),50,1,2) AS VARCHAR2(50))),
        *"ACTION_TYPE"* AS (CAST(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(XMLQUERY(
        'declare default element namespace "http://www.cigna.com/acme/domains/actions/2010/03"; (::)                                                      
    declare namespace xsi="http://www.w3.org/2001/XMLSchema-instance"; (::)                                                      
    local-name-from-QName(QName("http://www.cigna.com/acme/domains/actions/2010/03",/action/@xsi:type))                                                                  
    '
        PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
        16777216,0),50,1,2) AS VARCHAR2(50))),
        *"ACTN_ID"* AS (CAST(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(XMLQUERY(
        'declare default element namespace "http://www.cigna.com/acme/domains/actions/2010/03";/action/@id'
        PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
        16777216,0),50,1,2) AS VARCHAR2(50))),
        *"STATUS"*AS (CAST(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(XMLQUERY(
        'declare default element namespace "http://www.cigna.com/acme/domains/actions/2010/03";/action/@status'
        PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
        16777216,0),50,1,2) AS VARCHAR2(20))),
        *"ACME_MBR_ID"* AS (CAST(SYS_XQ_UPKXML2SQL(SYS_XQEXVAL(XMLQUERY(
        'declare default element namespace "http://www.cigna.com/acme/domains/actions/2010/03";/action/acmeMemberId'
        PASSING BY VALUE SYS_MAKEXML(128,"XMLDATA") RETURNING CONTENT ),0,0,
        16777216,0),50,1,2) AS VARCHAR2(50)))
      )
      PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE
      (
        INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0
        FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT
        CELL_FLASH_CACHE DEFAULT
      )
      TABLESPACE "ACME_DATA" ;
    CREATE UNIQUE INDEX *"CROUTREACH"."SYS_C0014547"* ON "CROUTREACH"."ACTION"
      (
        "SYS_NC_OID$"
      )
      PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE
      (
        INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0
        FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT
        CELL_FLASH_CACHE DEFAULT
      )
      TABLESPACE "ACME_DATA" ;
    CREATE UNIQUE INDEX *"CROUTREACH"."SYS_IL0000082156C00003$$"* ON "CROUTREACH".
      "ACTION"
      (
        PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 NEXT 1048576
        MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST
        GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
        TABLESPACE "ACME_DATA" PARALLEL (DEGREE 0 INSTANCES 0) ;
    CREATE UNIQUE INDEX *"CROUTREACH"."ACTN_ID_PK"* ON "CROUTREACH"."ACTION" (
      "ACTN_ID") PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(
      INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0
      FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT
      CELL_FLASH_CACHE DEFAULT) TABLESPACE "ACME_DATA" ;
      CREATE
        INDEX *"CROUTREACH"."ACTION_STAT_RSN_IDX"* ON "CROUTREACH"."ACTION"
        (
          "STAT_RSN"
        )
        PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE
        (
          INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE
          0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT
          CELL_FLASH_CACHE DEFAULT
        )
        TABLESPACE "ACME_DATA" ;
      CREATE
        INDEX *"CROUTREACH"."ACTION_UPDT_DT_IDX"* ON "CROUTREACH"."ACTION"
        (
          "UPDT_DT"
        )
        PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE
        (
          INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE
          0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT
          CELL_FLASH_CACHE DEFAULT
        )
        TABLESPACE "ACME_DATA" ;
      CREATE
        INDEX *"CROUTREACH"."ACTION_CRET_DT_IDX"* ON "CROUTREACH"."ACTION"
        (
          "CRET_DT"
        )
        PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE
        (
          INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE
          0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT
          CELL_FLASH_CACHE DEFAULT
        )
        TABLESPACE "ACME_DATA" ;
      CREATE
        INDEX *"CROUTREACH"."ACTION_STAT_DT_IDX"* ON "CROUTREACH"."ACTION"
        (
          "STAT_DT"
        )
        PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE
        (
          INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE
          0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT
          CELL_FLASH_CACHE DEFAULT
        )
        TABLESPACE "ACME_DATA" ;
      CREATE
        INDEX *"CROUTREACH"."ACTION_MBRID_TYP_STAT_IDX"* ON "CROUTREACH"."ACTION"
        (
          "ACME_MBR_ID",
          "ACTION_TYPE",
          "STATUS"
        )
        PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE
        (
          INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE
          0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT
          CELL_FLASH_CACHE DEFAULT
        )
        TABLESPACE "ACME_DATA" ;
      CREATE
        INDEX *"CROUTREACH"."ACT_ACTDEF_URN_IDX"* ON "CROUTREACH"."ACTION"
        (
          "ACTION_DEF_URN"
        )
        PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE
        (
          INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE
          0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT
          CELL_FLASH_CACHE DEFAULT
        )
        TABLESPACE "ACME_DATA" ;
      CREATE
        INDEX *"CROUTREACH"."ACTION_ACT_DEF_ID_STATUS_IDX"* ON "CROUTREACH"."ACTION"
        (
          "ACT_DEF_ID",
          "STATUS"
        )
        PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE
        (
          INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE
          0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT
          CELL_FLASH_CACHE DEFAULT
        )
        TABLESPACE "ACME_DATA" ;
    Any suggestions much appreciated.

    Kind regards
    Richard Blanchard

    Hi Rick,

    Thanks for adding the sample.

    First note: you use namespaces by default, different in the example of XML and the request - this a misspelling due to your mask real names?

    In any case, I see two problems with the UPDATE statement:

    (1) unless it is really part of the id, do not double-cover the value:

    @id="'888a80be-d69f-464d-b3f7-85b6209f918e'"
    

    must be:

    @id="888a80be-d69f-464d-b3f7-85b6209f918e"
    

    or as a variable binding (see below)

    (2) just like other XML features, XMLExists supports the names. You must declare any namespace as you lower to use XQuery in the expression (in this case, the default namespace).

    It works for me:

    SQL> create table action of xmltype
      2  xmltype store as securefile binary xml
      3  ;
    
    Table created.
    
    SQL> insert into action
      2  values (
      3   xmltype('
      4  
     13     abcdefghijklmnop
     14     qrstuvwxyz
     15     
     16        urn:coderunner:Medical:Definition:ServiceService:11111:7
     17        
     18           Access Profile~Why did you access the profile?~Reason for access?
     19        
     20     
     21  ')
     22  );
    
    1 row created.
    
    SQL> commit;
    
    Commit complete.
    
    SQL> UPDATE action
      2  SET object_value =
      3      updatexml( object_value
      4               , '/action/@status'
      5               , 'triggered'
      6               , 'xmlns="http://www.xxxxxx.ddd/mmm/domains/actions/2010/03"' )
      7  WHERE XMLExists( 'declare default element namespace "http://www.xxxxxx.ddd/mmm/domains/actions/2010/03"; (::)
      8                   /action[@id=$action_id]'
      9                   passing object_value
     10                         , 'dfdfdfdfdfddfdfdfdfdfdf' as "action_id"
     11                   )
     12  ;
    
    1 row updated.
    
    SQL> SELECT XMLCast(
      2           XMLQuery('declare default element namespace "http://www.xxxxxx.ddd/mmm/domains/actions/2010/03"; (::)
      3                     /action/@status'
      4                     passing object_value returning content)
      5           as varchar2(30)
      6         ) as status
      7  FROM action
      8  ;
    
    STATUS
    ------------------------------
    triggered
    
  • using plsql table and ref cursor in oracle's 10 g

    Hi all
    Can someone give me an example of a scenario where we need to create a form manually based on a stored database procedure.
    And in this process, I created a pl/sql table and a Ref cursor at the database level.

    CREATE OR REPLACE PACKAGE SCOTT. TYPE BONUS_PKG IS bonus_rec
    IS (RECORD
    EmpNo bonus_EMP.empno%TYPE,
    Ename bonus_EMP.ename%TYPE,
    employment bonus_EMP.job%TYPE,
    SAL bonus_EMP.sal%TYPE,
    Comm bonus_EMP.comm%TYPE);

    TYPE b_cursor IS REF CURSOR RETURN bonus_rec;
    TYPE bontab IS TABLE OF bonus_rec INDEX DIRECTORY.

    PROCEDURE bonus_refcur (bonus_data IN OUT b_cursor);
    PROCEDURE bonus_query (bonus_data IN OUT bontab);
    END bonus_pkg;


    CREATE OR REPLACE PACKAGE BODY SCOTT. BONUS_PKG IS
    PROCEDURE bonus_query (bonus_data IN OUT bontab) IS
    II NUMBER;
    CURSOR bonselect IS
    SELECT empno, ename, job, sal, comm bonus_EMP ORDER BY empno;
    BEGIN
    OPEN bonselect.
    II: = 1;
    LOOP
    Look FOR bonselect IN
    .EmpNo bonus_data (ii),
    .ename bonus_data (ii),
    .job bonus_data (ii),
    .Sal bonus_data (ii),
    .comm bonus_data (ii);
    EXIT WHEN bonselect % NOTFOUND;
    II: = ii + 1;
    END LOOP;
    END bonus_query;

    PROCEDURE bonus_refcur (bonus_data IN OUT b_cursor) IS
    BEGIN
    Bonus_data OPEN to SELECT empno, ename, job, sal, comm bonus_EMP ORDER BY empno;
    END bonus_refcur;

    END bonus_pkg;

    I want to fill in the data in the forms manually is not using Forms data block Wizard and by program.

    Please answer...

    Can someone give me an example of a scenario where we need to create a form manually based on a stored database procedure.

    In general, you will use a block of proceedings based when you have a collection of data from several tables presented in a form and your username must be able to update the information displayed.

    In your sample code, looks like you are using Oracle Support document "Melting a block on a Stored Procedure - examples of Code [ID 66887.1]". If this is the case, continue to follow the document - it guides you through all the steps. There is no need to manually configure things that the data block Wizard will work for you!

    I want to fill in the data in the forms manually is not using Forms data block Wizard and by program.

    Why? Let the wizard block configuration data of your block based on a procedure for you. There is no need to manually browse the data! I did what you're trying, and it's more work needed. Leave forms to do the work for you. :)

    If you absolutely have to do things manually, I recommend that you use the PROCEDURE bonus_query (bonus_data IN OUT bontab) instead of bonus_refcur (bonus_data IN OUT b_cursor) . Then, in your code create a variable of type BONTAB, and then call the bonus_query procedure. Then, it's a simple case of a loop in the table of records returned by the bonus_query procedure. For example:

    DECLARE
       t_bonus    bonus_pkb.bontab;
    BEGIN
       bonus_pkg.bonus_query(t_bonus);
    
       FOR i in 1 .. t_bonus.count LOOP
          :YOUR_BLOCK.EMPLOYEE_NUMBER := t_bonus(i).empno;
          :YOUR_BLOCK.EMPLOYEE_NAME := t_bonus(i).ename;
          :YOUR_BLOCK.EMPLOYEE_JOB := t_bonus(i).job;
          :YOUR_BLOCK.EMPLOYEE_SALARY := t_bonus(i).sal;
          :YOUR_BLOCK.EMPLOYEE_COMMISSION := t_bonus(i).comm;
       END LOOP;
    END;
    

    This code example shows the basics, but as is the sample code - you will need to adapt to your situation.

    Also, I highly recommend that you look at the article inol listed. It is a very thorough debate on the REF CURSOR. If you have set up using a procedure based on the data source - it is more effective to spend the record table to your form that it must pass a ref cursor Using a ref cursor, you might as well just using a standard called cursor and loops on your named cursor. The effect is the same (a line returned at the same time creating lots of network traffic). Using the table of records is more efficient because the data set is returned if the network traffic is reduced.

    Hope this helps,
    Craig B-)

    If someone useful or appropriate, please mark accordingly.

  • Update using lead/rank

    Goodmorning,

    I have a little trouble trying to update using lead/rank.

    Summary of the issue: My table contains duplicate data (only difference being 2 fields reason viewer_org & interest) and rather than the operation/processing multuple lines I want to assign the org of duplicate records Viewer and then I can hold 1 row, which has a list of org that can consult them.

    I took a few of the fields of interest here: -.
    create table copy_test 
    (
     OWNER_ORG varchar(10),
     GEN_REC NUMBER(10),
     VIEWER_ORG varchar(10),
     INTEREST_REASON varchar(10),
     col_1 varchar(10),
     col_2 varchar(10),
     col_3 varchar(10),
     col_4 varchar(10)
    );
    Samples: -.
    INSERT INTO COPY_TEST (OWNER_ORG ,GEN_REC ,VIEWER_ORG ,INTEREST_REASON ,COL_1 ,COL_2 ,COL_3 ,COL_4 ) VALUES ('5AA' ,12345 ,'5AA' ,'6543' ,'' ,'' ,'' ,''  );
    INSERT INTO COPY_TEST (OWNER_ORG ,GEN_REC ,VIEWER_ORG ,INTEREST_REASON ,COL_1 ,COL_2 ,COL_3 ,COL_4 ) VALUES ('5AA' ,12345 ,'5BB' ,'5430' ,'' ,'' ,'' ,''  );
    INSERT INTO COPY_TEST (OWNER_ORG ,GEN_REC ,VIEWER_ORG ,INTEREST_REASON ,COL_1 ,COL_2 ,COL_3 ,COL_4 ) VALUES ('5BB' ,32165 ,'5CC' ,'430' ,'' ,'' ,'' ,''  );
    INSERT INTO COPY_TEST (OWNER_ORG ,GEN_REC ,VIEWER_ORG ,INTEREST_REASON ,COL_1 ,COL_2 ,COL_3 ,COL_4 ) VALUES ('5BB' ,32165 ,'5AA' ,'5430' ,'' ,'' ,'' ,''  );
    INSERT INTO COPY_TEST (OWNER_ORG ,GEN_REC ,VIEWER_ORG ,INTEREST_REASON ,COL_1 ,COL_2 ,COL_3 ,COL_4 ) VALUES ('5BB' ,32165 ,'5BB' ,'6543' ,'' ,'' ,'' ,''  );
    INSERT INTO COPY_TEST (OWNER_ORG ,GEN_REC ,VIEWER_ORG ,INTEREST_REASON ,COL_1 ,COL_2 ,COL_3 ,COL_4 ) VALUES ('YAA' ,98765 ,'5AA' ,'0' ,'' ,'' ,'' ,''  );
    INSERT INTO COPY_TEST (OWNER_ORG ,GEN_REC ,VIEWER_ORG ,INTEREST_REASON ,COL_1 ,COL_2 ,COL_3 ,COL_4 ) VALUES ('YAA' ,98765 ,'5BB' ,'543' ,'' ,'' ,'' ,''  );
    Data looks like this: -.
     select * from copy_test;
    
    OWNER_ORG     GEN_REC VIEWER_ORG INTEREST_R COL_1      COL_2      COL_3      COL_4
    ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----------
    5AA             12345 5AA        6543
    5AA             12345 5BB        5430
    5BB             32165 5CC        430
    5BB             32165 5AA        5430
    5BB             32165 5BB        6543
    YAA             98765 5AA        0
    YAA             98765 5BB        543
    Essential, we have 3 examples above (claim on gen_rec). The 1st example 5AA owner is a record that the Organization 5AA and 5BB are allowed to see. That's why he existing twice, viewer_org 5AA on 1 row and 5BB on the other. Then I need to assign these two organizations against one of the lines. I stated thise who strives to identify (a little): -.
    SET LINESIZE 250;
    
    select GEN_REC ,VIEWER_ORG ,INTEREST_REASON,OWNER_ORG,VIEWER_ORG CL_1,
    LEAD (VIEWER_ORG,1,0) OVER (PARTITION BY GEN_REC ORDER BY GEN_REC ,VIEWER_ORG ,INTEREST_REASON,OWNER_ORG) as CL_2,
    LEAD (VIEWER_ORG,2,0) OVER (PARTITION BY GEN_REC ORDER BY GEN_REC ,VIEWER_ORG ,INTEREST_REASON,OWNER_ORG) as CL_3,
    LEAD (VIEWER_ORG,3,0) OVER (PARTITION BY GEN_REC ORDER BY GEN_REC ,VIEWER_ORG ,INTEREST_REASON,OWNER_ORG) as CL_4,
    RANK() OVER (PARTITION BY GEN_REC ORDER BY GEN_REC ,VIEWER_ORG ,INTEREST_REASON,OWNER_ORG) rank
    from COPY_TEST 
    order by GEN_REC ,VIEWER_ORG ,INTEREST_REASON,OWNER_ORG;
    Gives these results:--
       GEN_REC VIEWER_ORG INTEREST_R OWNER_ORG  CL_1       CL_2       CL_3       CL_4             RANK
    ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----------
         12345 5AA        6543       5AA        5AA        5BB        0          0                   1
         12345 5BB        5430       5AA        5BB        0          0          0                   2
         32165 5AA        5430       5BB        5AA        5BB        5CC        0                   1
         32165 5BB        6543       5BB        5BB        5CC        0          0                   2
         32165 5CC        430        5BB        5CC        0          0          0                   3
         98765 5AA        0          YAA        5AA        5BB        0          0                   1
         98765 5BB        543        YAA        5BB        0          0          0                   2
    This is the result, I need: -.
    GEN_REC     VIEWER_ORG     INTEREST_R     OWNER_ORG     CL_1     CL_2     CL_3     CL_4
    12345     5AA     6543     5AA     5AA     5BB          
    12345     5BB     5430     5AA                    
    32165     5AA     5430     5BB                    
    32165     5BB     6543     5BB     5BB     5AA     5CC     
    32165     5CC     430     5BB                    
    98765     5AA     0     YAA                    
    98765     5BB     543     YAA     5AA     5BB          
    I need the information in the viewer_org field to be placed in depeneding CL_1 CL_2, CL_3 or CL_04 the number of duplicate rows it y a. (is never more than 4) the hierarchy of what line I want to update would be pitched what was the Interest_reason above, even if this isn't a body of numbers It may be that '0' is important.


    Any ideas guys?

    One way would be to use Polish CASE in SELECT

    with t_data as
    (
    SELECT
         GEN_REC ,
         VIEWER_ORG ,
         INTEREST_REASON,
         MAX(INTEREST_REASON) OVER (PARTITION BY GEN_REC) as max_int_reason,
         OWNER_ORG,
         VIEWER_ORG CL_1,
         LEAD (VIEWER_ORG,1,0) OVER (PARTITION BY GEN_REC ORDER BY GEN_REC ,VIEWER_ORG ,INTEREST_REASON,OWNER_ORG) AS CL_2,
         LEAD (VIEWER_ORG,2,0) OVER (PARTITION BY GEN_REC ORDER BY GEN_REC ,VIEWER_ORG ,INTEREST_REASON,OWNER_ORG) AS CL_3,
         LEAD (VIEWER_ORG,3,0) OVER (PARTITION BY GEN_REC ORDER BY GEN_REC ,VIEWER_ORG ,INTEREST_REASON,OWNER_ORG) AS CL_4,
         RANK() OVER (PARTITION BY GEN_REC ORDER BY GEN_REC ,VIEWER_ORG ,INTEREST_REASON,OWNER_ORG) rank
    FROM
         COPY_TEST
    ORDER BY
         GEN_REC ,
         VIEWER_ORG ,
         INTEREST_REASON,
         OWNER_ORG
    )
    SELECT
         t1.GEN_REC,
         VIEWER_ORG ,
         INTEREST_REASON,
         CASE
              WHEN INTEREST_REASON = max_int_reason
              THEN
              (SELECT
                   decode(cl_1,'0',null,cl_1)
              FROM
                   t_data t2
              WHERE
                   rank          = 1
              AND t1.gen_rec = t2.gen_rec)
              ELSE
              null
         END cl_1,
         CASE
              WHEN INTEREST_REASON = max_int_reason
              THEN
              (SELECT
                   decode(cl_2,'0',null,cl_2)
              FROM
                   t_data t2
              WHERE
                   rank          = 1
              AND t1.gen_rec = t2.gen_rec)
              ELSE
              null
         END cl_2,
         CASE
              WHEN INTEREST_REASON = max_int_reason
              THEN
              (SELECT
                   decode(cl_3,'0',null,cl_3)
              FROM
                   t_data t2
              WHERE
                   rank          = 1
              AND t1.gen_rec = t2.gen_rec)
              ELSE
              null
         END cl_3,
         CASE
              WHEN INTEREST_REASON = max_int_reason
              THEN
              (SELECT
                   decode(cl_4,'0',null,cl_4)
              FROM
                   t_data t2
              WHERE
                   rank          = 1
              AND t1.gen_rec = t2.gen_rec)
              ELSE
              null
         END cl_4
    FROM
         t_data t1 ;
    
    GEN_REC                VIEWER_ORG INTEREST_REASON CL_1       CL_2       CL_3       CL_4
    ---------------------- ---------- --------------- ---------- ---------- ---------- ----------
    12345                  5AA        6543            5AA        5BB
    12345                  5BB        5430
    32165                  5AA        5430
    32165                  5BB        6543            5AA        5BB        5CC
    32165                  5CC        430
    98765                  5AA        0
    98765                  5BB        543             5AA        5BB                              
    
     7 rows selected 
    
  • How update the relational table with XML data?

    I get XML messages that include a bunch of data items to be updated in a table. An arbitrary subset of rows is updated for each message received.

    The output of the following example is correct, but the use of the intermediate table that bothers me. The temporary table can be eliminated somehow? Or is the most reasonable way to loop just explicitly and parse the XML message and then update each row separately?

    I'm under 11.2.0.1.0.
    create table otn9test (
      id number not null primary key,
      data xmltype
    );
    
    insert into otn9test values (1, xmltype('<data>default for 1</data>'));
    insert into otn9test values (2, xmltype('<data>default for 2</data>'));
    insert into otn9test values (3, xmltype('<data>default for 3</data>'));
    
    create table otn9input (
      id number,
      data xmltype
    );
    
    column data format a30
    
    declare
      updata constant xmltype := xmltype('<root>
      <item>
        <id>1</id>
        <data>Id 1 updated.</data>
      </item>
      <item>
        <id>3</id>
        <data>Id 3 updated.</data>
      </item>
      <item>
        <id>4</id>
        <data>Id 4 updated.</data>
      </item>
    </root>');
    
    begin
      insert into otn9input
        select * from
        xmltable('/root/item' passing updata
              columns
              id number path 'id',
              data xmltype path 'data');
    
      update otn9test t set data = (
        select data from otn9input i
        where t.id = i.id
      ) where t.id in (select id from otn9input);
    
      commit;
    end;
    /
    
    select * from otn9input;
    
    /*
         ID DATA
    ---------- ------------------------------
          1 <data>Id 1 updated.</data>
          3 <data>Id 3 updated.</data>
          4 <data>Id 4 updated.</data>
    */
    
    select * from otn9test;
    
    /*
         ID DATA
    ---------- ------------------------------
          1 <data>Id 1 updated.</data>
          2 <data>default for 2</data>
          3 <data>Id 3 updated.</data>
    */
    
    drop table otn9input;
    drop table otn9test;

    The temporary table can be eliminated somehow?

    You can do it with the MERGER:

    merge into otn9test t
    using (
      select id, data
      from xmltable('/root/item' passing updata
            columns
              id   number  path 'id',
              data xmltype path 'data'
           )
    ) x
    on ( t.id = x.id )
    when matched then update
     set t.data = x.data
    ;
    

    However, if you are looking for performance on large data sets, I think that the best is to use an intermediate table of XMLType (binary storage) to maintain the XML instance.

    create table otn9input of xmltype
    xmltype store as securefile binary xml;
    
    insert into otn9input values(
    xmltype('
      
        1
        Id 1 updated.
      
      
        3
        Id 3 updated.
      
      
        4
        Id 4 updated.
      
    ')
    );
    
    merge into otn9test t
    using (
    select id, data
    from otn9input,
         xmltable('/root/item' passing object_value
              columns
                id number path 'id',
                data xmltype path 'data'
         )
    ) x
    on ( t.id = x.id )
    when matched then update
     set t.data = x.data
    ;
    

    A structured XMLIndex could also help.

  • Insert and update the nested table

    Hello

    I created a nested table containing the following columns. I need to insert records into the nested table. And also I have to update the nested table. Please find below my table and get error message.

    Please advose...!
    SQL> create type details as object(
      2  basic number(7,2),
      3  da number(6,2),
      4  hra number(6,2),
      5  pf number(6,2),
      6  it number(6,2),
      7  gross number(7,2),
      8  ded number(6,2),
      9  net number(8,2));
     10  /
    
    Type created.
    
    SQL> create type details_t is table of details;
      2  /
    
    Type created.
    
    
    SQL> ed
    Wrote file afiedt.buf
    
      1  create table emp_tab(empno number(4),name varchar2(10),details_tab details_t)
      2* nested table details_tab store as empl_details
    SQL> /
    
    Table created.
    
    
    SQL> ed
    Wrote file afiedt.buf
    
      1* insert into emp_tab values(&empno,'&name',details_t(details(&da,&hra,&pf,&it,null,null,null)))
    SQL> /
    Enter value for empno: 1
    Enter value for name: asdf
    Enter value for da: 120
    Enter value for hra: 130
    Enter value for pf: 120
    Enter value for it: 120
    old   1: insert into emp_tab values(&empno,'&name',details_t(details(&da,&hra,&pf,&it,null,null,null
    new   1: insert into emp_tab values(1,'asdf',details_t(details(120,130,120,120,null,null,null)))
    insert into emp_tab values(1,'asdf',details_t(details(120,130,120,120,null,null,null)))
                                                 *
    ERROR at line 1:
    ORA-02315: incorrect number of arguments for default constructor
    Can I use '&' while inserting records in the nested table? Yes / No?

    I do need to update also net gross, ded, columns... !!

    Please help me... !!

    Concerning
    A
    $ sqlplus scott/tiger
    
    SQL*Plus: Release 10.2.0.2.0 - Production on Thu Apr 21 16:18:16 2011
    
    Copyright (c) 1982, 2005, Oracle.  All Rights Reserved.
    
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
    With the Partitioning, OLAP and Data Mining options
    
    SQL> CREATE TYPE details AS OBJECT(
     basic NUMBER(7,2),
     da NUMBER(6,2),
     hra NUMBER(6,2),
     pf NUMBER(6,2),
     it NUMBER(6,2),
     gross NUMBER(7,2),
     ded NUMBER(6,2),
     net NUMBER(8,2));  2    3    4    5    6    7    8    9
     10  /
    
    Type created.
    
    SQL> CREATE TYPE details_t IS TABLE OF details;
      2  /
    
    Type created.
    
    SQL> CREATE TABLE emp_tab(empno NUMBER(4),name VARCHAR2(10),details_tab details_t)
     NESTED TABLE details_tab store as empl_details  2
      3  /
    
    Table created.
    
    SQL> INSERT INTO emp_tab VALUES(7001,'Saubhik',details_t(details(100,100,50,10,10,null,null,null)));
    
    1 row created.
    
    SQL> SELECT * FROM TABLE (SELECT details_tab FROM emp_tab WHERE empno=7001);
    
         BASIC         DA        HRA         PF         IT      GROSS        DED
    ---------- ---------- ---------- ---------- ---------- ---------- ----------
           NET
    ----------
           100        100         50         10         10
    
    SQL> ^C
    
    SQL> ed
    Wrote file afiedt.buf
    
      1  UPDATE TABLE (SELECT details_tab FROM emp_tab WHERE empno=7001)
      2     emp_sal
      3*    SET emp_sal.net=emp_sal.basic+emp_sal.da+emp_sal.hra
    SQL> /
    
    1 row updated.
    
    SQL> SELECT * FRM emp_tab;
    SELECT * FRM emp_tab
             *
    ERROR at line 1:
    ORA-00923: FROM keyword not found where expected
    
    SQL> SELECT * FROM emp_tab;
    
         EMPNO NAME
    ---------- ----------
    DETAILS_TAB(BASIC, DA, HRA, PF, IT, GROSS, DED, NET)
    --------------------------------------------------------------------------------
          7001 Saubhik
    DETAILS_T(DETAILS(100, 100, 50, 10, 10, NULL, NULL, 250))
    
    SQL>
    
  • Recent update of DB table

    Hello

    I have connected to a database (oracle 11g) through Toad, an i working with a Client on it.
    in the Client to make a few changes to data, I want to know is there a way of knowing
    which table has been recently updated or the table has been affected by the last
    Shares of the customer.

    concerning

    MDK.

    Published by: MDK on Jan 28, 2010 16:08

    Published by: MDK on Jan 28, 2010 16:12

    You may be able to use characteristic flame to get what you need, if auditing is not enabled:

    SELECT  TABLE_OWNER
    ,       TABLE_NAME
    ,       OPERATION
    ,       LOGON_USER
    FROM    FLASHBACK_TRANSACTION_QUERY
    WHERE   COMMIT_TIMESTAMP = (
                                    SELECT  MAX(COMMIT_TIMESTAMP)
                                    FROM FLASHBACK_TRANSACTION_QUERY
                               );
    
  • PPR for the updating of the table after a click in a butto in Jdeveloper 10.1.3 - thanks

    Hi people,

    I looked through many messages about refreshing the page, but still did not solve my problem. Please help me. It's quite URGENT.

    I have a table with a command button. After you click the data insertion is engaged and the table is supposed to be updated to reflect the changes.

    Now I use PPR as my solution: the button is the initiator and the table is the target. I put the button property: part delivery = true and its id as a partial release of the table value

    What I missed, please?

    Note: reloading of the entire page is not a solution for me. (The table is incorporated within a region of showOneTab and there are other tables in different tabs)

    Thanks in advance!

    Assuming that nothing wrong with the JavaScript syntax, the explanation might be: If you ActionListener Installer (data transaction method) and javaScript on a button-click the button, the button click javaScript will not be executed. (???)

    This is not the case. In my application, the two actions of script and java onclick button are executed. Javascript onclick fires first, then the action of the button. It should be the same for actionlistener as well.

    Regarding the updating of the table after a click of a button inside the table, you can do this by forcing the partial relaxation of the table of a bean to support using addPartialTarget.

    On the actionListener to the button call the below the backup method of bean.

    Here is the code example:

        public void btnSample_actionListener(ActionEvent actionEvent) {
           // First execute the method on the button
           BindingContainer bindings = getBindings();
            OperationBinding operationBinding = bindings.getOperationBinding("buttonMethod");
            Object result = operationBinding.execute();
    
            //Refresh the iterator of table and partial trigger the table
            OperationBinding operationBindingTab =
                bindings.getOperationBinding("RefreshTable");
            Object resultTab = operationBindingTab.execute();
            AdfFacesContext.getCurrentInstance().addPartialTarget(myTable);
    

    RefreshTable is an action that runs the Execute method on the table iterator.

    Thank you
    Mitesh.

Maybe you are looking for

  • Do not open file pages

    Hihi, The documents I created with Pages is not opening. It was impossible to open only the oldest documents that I created less than a month back. But just yesterday, I created a new document does not open more. When I click on a document page, the

  • Dimensions of 160 cable pins for the NI PXI-2530 b

    Hello My mechanical design team wants to know the measures of the 160 cable pins for the NI PXI-2530 b. It will take a while before we get the cable we ordered. I couldn't find a data sheet with details of the measure; are they? Alternatively, y Figu

  • Windows Server 2012 R2 - Hyper-V role

    I have a Hyper-V host that has 2 virtual machines running. One is a fileshare that we show you the physical drive on the host. The problem is that this site has monthly updates of DVD to a program, and the VM fileshare continues to lose the DVD playe

  • Is it possible to change the default display of some files?

    Original title: default display for certain folders? Some files still have the text.  Still, some folders have pictures.  Photos should be displayed as thumbnails; text list or details.  Is it possible to implement this?  Folder options is rather poi

  • Hardware upgrades

    Hello I tried to update my RAM. So I looked upward. But here it says find maximam allowed on specifications. But the specification only tell me the INSTALLED news. I want admitted maximam, Types, etc...Can you help me where to find it? Thank you