How to MERGE when the target table contains invisible columns?
Oracle running on Oracle Linux 6.4 12.1.0.2.0 database:
During his studies of FUSION with invisible columns, I discovered that invisible columns in the target table cannot be read. Workaround seems to be
MERGE INTO (SELECT <column list> FROM <target table>) AS <alias>
However, the documentation does not seem to allow this. Here are the details.
Test data
> CREATE TABLE t_target( k1 NUMBER PRIMARY KEY, c1 NUMBER, i1 NUMBER invisible ) table T_TARGET created. > INSERT INTO t_target (k1,c1,i1) SELECT 2, 2, 2 FROM dual UNION ALL SELECT 3, 3, 3 FROM dual UNION ALL SELECT 4, 4, 4 FROM dual 3 rows inserted. > CREATE TABLE t_source( k1 NUMBER PRIMARY KEY, c1 NUMBER, i1 NUMBER invisible ) table T_SOURCE created. > INSERT INTO t_source (k1,c1,i1) SELECT 1, 1, 1 FROM dual UNION ALL SELECT 2, 2, 9999 FROM dual UNION ALL SELECT 3, 3, 3 FROM dual 3 rows inserted.
First try
Please note that I have a WHERE clause in the WHEN MATCHED clause. Its purpose is to avoid the update of a row when data are already correct. The WHERE clause is trying to read the invisible column of the target table.
> MERGE INTO t_target o USING ( SELECT k1, c1, i1 FROM t_source ) n ON (o.k1 = n.k1) WHEN MATCHED THEN UPDATE SET c1=n.c1, i1=n.i1 WHERE 1 IN ( decode(o.c1,n.c1,0,1), decode(o.i1,n.i1,0,1) ) WHEN NOT MATCHED THEN INSERT (k1, c1, i1) VALUES(n.k1, n.c1, n.i1) ... Error at Command Line : 10 Column : 12 Error report - SQL Error: ORA-00904: "O"."I1": invalid identifier
As you can see, I put a subquery after the USING clause so that 'n.i1' would be 'visible', but this is not enough since the 'I1' column in the target table is always invisible.
Second test
> MERGE INTO ( SELECT k1, c1, i1 FROM t_target ) o USING ( SELECT k1, c1, i1 FROM t_source ) n ON (o.k1 = n.k1) WHEN MATCHED THEN UPDATE SET c1=n.c1, i1=n.i1 WHERE 1 IN ( decode(o.c1,n.c1,0,1), decode(o.i1,n.i1,0,1) ) WHEN NOT MATCHED THEN INSERT (k1, c1, i1) VALUES(n.k1, n.c1, n.i1) 2 rows merged.
Here I used a subquery in the INTO clause thus, and it worked.
Unfortunately, this does not seem to be admitted in the documentation: IN fact refers to a table or a view as schema objects.
My question is:
How can I refer to invisible columns in the target table without creating a new object? My workaround using a subquery solution seems to work very well, but can I recommend if it is not documented?
Can I replace a "inline view" for a view and still be supported?
During his studies of FUSION with invisible columns, I discovered that invisible columns in the target table cannot be read. Workaround seems to be
However, the documentation does not seem to allow this. Here are the details.
Here I used a subquery in the INTO clause thus, and it worked.
Unfortunately, this does not seem to be admitted in the documentation: IN fact refers to a table or a view as schema objects.
My question is:
How can I refer to invisible columns in the target table without creating a new object? My workaround using a subquery solution seems to work very well, but can I recommend if it is not documented?
Can I replace a "inline view" for a view and still be supported?
But the documentation DO ALLOWS not only! You use a view - a view online and those that can be changed in a MERGE statement.
All versions of the doc for FUSION since 9i specifically say this:
INTO clause
Use the
INTO
target clause to specify the table or view you are updating or inserting into. To merge the data in a view, the view must be updated. Please refer to the "Notes on the editable views" for more information.
Here are the links for the doc. 9i, 10g, 11g and c 12, ALL OF THEM (the last three), except 9i have this EXACT clause above.
SQL statements: INDICATED to ROLLBACK FALLS, 15 of 19
http://docs.Oracle.com/CD/B19306_01/server.102/b14200/statements_9016.htm
http://docs.Oracle.com/CD/B28359_01/server.111/b28286/statements_9016.htm
https://docs.Oracle.com/database/121/SQLRF/statements_9016.htm
9i doc does not have this specific quote in the INTO clause section, but it doesn't have that quote a little later:
Limitation of the update of a view
- You cannot specify
DEFAULT
when refreshing a view.- You cannot update a column referenced in the
ON
condition
clause.
merge_insert_clause
The
merge_insert_clause
specifies the values to insert into the column of the target table, if the condition of theON
clause is false. If the insert clause is executed, then all insert triggers defined on the target table are activated.
Restrictions on the merger in a view
You cannot specify
DEFAULT
when refreshing a view.
If your "workaround" isn't really a workaround solution. You SHOULD use an inline view if you need to reference a column "invisible" in the target table, since otherwise, these columns are INVISIBLE!
My workaround using a subquery solution seems to work very well, but can I recommend if it is not documented?
You can recomment it because IT IS documented.
Tags: Database
Similar Questions
-
How do you create a message rule in outlook express when the subject line contains symbols
I get emails when the subject line contains square boxes. I tried to create a message for when rule the subject contains these square boxes, but cannot do so.
Any suggestions?
Thank you.
Then, it will not work. Unless the messages are always of the same address, or a domain, so the only option I see is of filter in your mail.
Start with the only rule of AddressBook and you receive a message that you want people not in your address book (E-mail from companies, bills, your ISP, etc), you can add them to the rule.
Tools | Message rules | Mail | New.
Box 1 - Where the From line contains people {check it out}
Box 2 - Check: delete it & stop processing more rules if you want messages not in the address book to go to deleted items, or you can create a spam folder and direct them here.
You can choose to delete the server, but be careful because you never have messages downloaded to any folder, if you choose this option.
Box 3 - Click on the blue words contains people
Click on the first address to select it. Scroll to the end and hold down the SHIFT key while you click the last address. This will highlight all. Right-click on it and click on from the menu that appears.
Now, click Options and choose: Message * contains no of * the people below in the top of the page Options area, then choose: Message corresponds to one of the people below in the background Options box.
OK your way out of the new rule.
Now, only the addresses that you entered will be uploaded to your Inbox. You won't see other emails.
Remember, if you add a person to your address book, you must add to the rule. It will not automatically be added.
Be sure to see these links for more options.
A few tips:
http://insideoe.tomsterdam.com/tips/rules.htmControl junk e-mail in Outlook Express:
http://www.Microsoft.com/Windows/IE/community/columns/junkmail.mspxMessage rules does not? :
http://www.insideoe.com/FAQs/why.htm#rules -
GET A DATE THE TARGET TABLE MAX
Hello friends,
Can someone tell me how to extract the date max of the target table.
Thank you.Azhar
Sorry why again once you are not able to use the aggregator operator to get a max value. You don't need a group of when taking a max value what from a table, unless otherwise specified
Try it with a simple table b table card
table (several itemno)
table b (number maxitem)
Use aggregator and don't put anything in the section of owb agg transformation group. Generate the code and take a look
-
Add records in the target table
Hi all
I HAV done an interface for a simple source data transfer to the target. When I run it, the records are stored in the target table. Now, I want to launch the interface (for the same or different source table) and add the records to existing records in the target table.
Kindly guide me, explaining how shud I do the addition in the target table.
Thanks in advance.Hello
You can use the IKM control add... it will add records...
Thank you.
-
ODI 12 c: IKM for differential insert and update with a sequence in the target table
Hello
I have a map where I fill in a column of my target table using a database sequence. Now my mapping is supposed to load the target gradually table. So I need a revenge for update and incremental insert. Now with this differential IKM it compares all the columns to match all colmuns line to understand, it should be an insert or update. Now, the following code shows that when the ROW_WID is loaded with a sequence of database.
If NOT EXISTS
(select 1 from W_LOV_D T
where T.ROW_WID = S.ROW_WID
and ((T.CREATED_BY = S.CREATED_BY) or (T.CREATED_BY IS NULL and S.CREATED_BY IS NULL)) and
....
....
< the rest of the comparison of columns >
)
So when running ODI returns following error
Caused by: java.sql.SQLSyntaxErrorException: ORA-00904: "S". "" ROW_WID ": invalid identifier
Please suggest if there is no other IKM I should use or if there is another way around it without changing the code IKM...
Hi Marc,
Thanks for your reply.
I had solved it. The incremental update process inserts all rows from the source table to I$ table that exists in the target table. It does so by the where sql such as mentioned in my questions as
WHERE THERE is NOT (
. COLUMNS = -
The logged data is not loaded in the target table in cdc-compatible?
Hello
I tried with cdc-simple concept on single table.
I had loaded, journaled table (only changed records) inserted in the simple target in cdc table. Its working fine.
When I work on cdc-consistent and logged data are not loaded in the target table
For this, I used the data model, it has 3 data stores. log the without option of data, its works very well.
When I am trying to load tables logged in the target table in interface, its running fine.
To do this, I chose "logged data only.
Although I have not changed the records in the target table. target table is empty after the executed insterface.
I chose the real option of insertion in ikm. But the logged data that is not inserted in the target table.
Please help me.
Thankin advacnce,
A.Kavya.
Hello
You must EXPAND WINDOW and LOCK SUBSCRIBERS before consuming the CDC data:
http://docs.Oracle.com/CD/E14571_01/integrate.1111/e12643/data_capture.htm#ODIDG283
Subsequently, you unlock Subscriber and purge the log.
Better to put a package to automate the whole thing.
-
Failed to truncate the target table while programming the interface in ODI
Hi Expertise,
I developed a scenario in an interface, where I planned keeping the option Truncate as false, right there the data is been going to target without any problems, but when I changed the status of truncate to TRUE, the interface is been run, but the array is not get truncated, rather the data's been loading again to target. (when running manually, the target table is been truncated perfectly) but not in programming.
Can someone help me in this problem.
Thank you
Shakur.
Have you regenerate the scenario in question since you changed the option Truncate. If you have not the regular job must still run the old code
-
OWB, I need to update the target table with the same field for game/update
OWb, I try to update the target table with the game and the update on the same ground is this possible. I'm a match merge error indicating that you cannot update and match on the same ground. But in SQl is my selection
Update table
define RFID = 0
where RFID = 1
and ID_processus = 'TEST '.
Can HWO I do this in OWB.I have check but in the case later (last one) that he warns no error if you can go with it.
and I tested it it worksYou can check the first case (from where we start) if it has been warned and then try to run.
-
How can you save the background image contained in a Thunderbird e-mail message
How can you save the background image contained in a Thunderbird e-mail message
Have you read the instructions which preceded the right click? What of their suite?
-
delete all, then insert into the target table, two steps in one transaction?
Hello
We have the following two steps in one ODI package, it will be managed in a single transaction?
procedure step 1): remove all of the target table.
interface in step 2): insert data in the source table in the target table.
our problem is that step 2 can take some minutes, and then the target table can temporary unusable for end users who try to access it, I'm good?
Kind regards
MarijoHello
It can be managed in a single transaction by selecting IKM as the Append and TRUNCATE/DELETEALL Option command in the FLOW of an interface tab.
Thanxs
Malezieux -
How can I write in a table cell (row, column appear) in a databae?
How can I write in a table cell (row, column appear) in a database using LabVIEW Database Toolkit? I use Ms Access. Suppose I have three columns in a table, I write 1 row of the 1st column, then 1st rank of the 3rd column. The problem I have is after writing the 1st column of 1st row, the reference goes to the second row, and if I write in the 3rd column, he goes to the 2nd row 3rd column. Any suggestion?
When you perform a SQL INSERT command, you create a new line. If you want to change an existing line, you must use the UPDATE command (i.e. UPDATE tablename SET column = value WHERE some_column = some_value). The some_column could be the unique ID of each line, date and time, etc.
I don't know what is the function to use in the Toolbox to execute a SQL command, since I do not use the Toolbox. Also, I don't understand why you don't do a single INSERT. It would be much faster.
-
Hi all
Can I combine the records in the nested table
I have a table with 2 colum: col_1 and col_2
col_1: corresponds to the id (varchar2)
col_2: is a column nested with the type of table (sub_col_1 (number), sub_col_2 (number))
for example: I have 2 accounts table ('a', (1,2)) and ('b', (3,4)))
what I want is merged into this table with values ('a', '4.5')) + ('c', (6,7)) IN a single statement
What I should have after this operation ('a', (1,2,4,5)) + ('b', (3,4)) + ('c', (6,7)).
Can I do this?
Oracle version: 11.2.0.3CREATE OR REPLACE TYPE TEST_TYPE AS OBJECT(SUB_COL_1 NUMBER, SUB_COL_2 NUMBER) ; CREATE OR REPLACE TYPE TEST_TYPE_TABLE IS TABLE OF TEST_TYPE; CREATE TABLE TEST_MERGE_NESTED_TABLE (COL_1 VARCHAR2(1 CHAR), COL_2 TEST_TYPE_TABLE) NESTED TABLE COL_2 STORE AS COL_2_NESTED; INSERT INTO TEST_MERGE_NESTED_TABLE VALUES('a',TEST_TYPE_TABLE(TEST_TYPE(1,2) )); INSERT INTO TEST_MERGE_NESTED_TABLE VALUES('b',TEST_TYPE_TABLE(TEST_TYPE(3,4) ));
Thank you all.
Published by: 966205 on 20:18 21/02/2013
Published by: 966205 on 20:42 21/02/2013966205 wrote:
That means he does the same thing as what I want (adding? do not recreate this column in the physical layer).Actually, no.
All content of the nested table is first removed (for the given FK), then the result of the MULTISET UNION is reinserted.The evidence on:
SQL> alter session set events '10046 trace name context forever, level 12'; Session altered. SQL> merge into test_merge_nested_table t 2 using ( 3 select 'a' col_1, TEST_TYPE_TABLE(TEST_TYPE(4,5)) col_2 from dual union all 4 select 'c' , TEST_TYPE_TABLE(TEST_TYPE(6,7)) from dual 5 ) v 6 on ( t.col_1 = v.col_1 ) 7 when matched then update 8 set t.col_2 = t.col_2 multiset union v.col_2 9 when not matched then insert (col_1, col_2) 10 values (v.col_1, v.col_2) ; 2 rows merged. SQL> alter session set events '10046 trace name context off'; Session altered. SQL> select * from test_merge_nested_table; C COL_2(SUB_COL_1, SUB_COL_2) - -------------------------------------------------------------------------------- c TEST_TYPE_TABLE(TEST_TYPE(6, 7)) a TEST_TYPE_TABLE(TEST_TYPE(1, 2), TEST_TYPE(4, 5)) b TEST_TYPE_TABLE(TEST_TYPE(3, 4))
TKPROF output:
DELETE, the nested table statement objectives associated with 'a' and deletes the line after line that it contains (1,2).
The later INSERTION is performed twice (run count = 2) and target the two nested table 'a' by inserting 2 ranks: former one (1,2) + the new one (4.5) and the nested table 'c' by inserting 1 row (6,7).SQL ID: 6bjc2z2t53csn Plan Hash: 132214516 DELETE /*+ REF_CASCADE_CURSOR */ FROM "DEV"."COL_2_NESTED" WHERE "NESTED_TABLE_ID" = :1 call count cpu elapsed disk query current rows ------- ------ -------- ---------- ---------- ---------- ---------- ---------- Parse 1 0.00 0.00 0 0 0 0 Execute 1 0.00 0.00 0 1 3 1 Fetch 0 0.00 0.00 0 0 0 0 ------- ------ -------- ---------- ---------- ---------- ---------- ---------- total 2 0.00 0.00 0 1 3 1 Misses in library cache during parse: 0 Optimizer mode: CHOOSE Parsing user id: SYS (recursive depth: 1) Number of plan statistics captured: 1 Rows (1st) Rows (avg) Rows (max) Row Source Operation ---------- ---------- ---------- --------------------------------------------------- 0 0 0 DELETE COL_2_NESTED (cr=1 pr=0 pw=0 time=44 us) 1 1 1 INDEX RANGE SCAN SYS_FK0000023444N00002$ (cr=1 pr=0 pw=0 time=10 us)(object id 23446) ********************************************************************************
******************************************************************************** SQL ID: 0fzd5yk23jyas Plan Hash: 0 INSERT /*+ NO_PARTIAL_COMMIT REF_CASCADE_CURSOR */ INTO "DEV"."COL_2_NESTED" ("NESTED_TABLE_ID","SYS_NC_ROWINFO$") VALUES (:1, :2) call count cpu elapsed disk query current rows ------- ------ -------- ---------- ---------- ---------- ---------- ---------- Parse 2 0.00 0.00 0 0 0 0 Execute 2 0.00 0.00 0 2 10 3 Fetch 0 0.00 0.00 0 0 0 0 ------- ------ -------- ---------- ---------- ---------- ---------- ---------- total 4 0.00 0.00 0 2 10 3 Misses in library cache during parse: 0 Optimizer mode: ALL_ROWS Parsing user id: 50 (recursive depth: 1) Number of plan statistics captured: 1 Rows (1st) Rows (avg) Rows (max) Row Source Operation ---------- ---------- ---------- --------------------------------------------------- 0 0 0 LOAD TABLE CONVENTIONAL (cr=1 pr=0 pw=0 time=113 us) ******************************************************************************** -
I'm trying to transfer a picture of the LabVIEW host program to the target in real time on a cRIO.
I'll set up a controlled loop that transfer values one via shared Variables.
It works fine when I run running to highlight.
However, if I have both allow to run at full speed, something goes wrong
and the size of the array ends correctly on the target.
Is there some tricks on how to transfer tables down
host to the target, or all the other pitfalls I should be aware when
work on a real-time target?
And Yes, I never took the course of the RT, so there might be some vital info miss me.
Martin
Hi Martin,
Why don't you use a SharedVariable taking a picture? Why can you transfer data one by one?
-
Query metadata ODI to find the source and the target table for Interface
Hi Experts,
Customer heading there source of EBS 11.5.10 in R12. They are BIApps ODI. 7952 version. Since then, all mappings there are customized they may not disturb on support of Oracle BIApps is concerned.
Now, we need to know how many ODI mappings there source EBS is the 11.5.10 in R12 migration and we can only target mappings accordingly.
So, please give me with entries below:
(1) any request for metadata that will give me the information of the source tables table and target them in against an if-same interface that the source of the main interface is another interface.
(2) what are the other stuffs that I need to look at from the point of view of the mapping changes when the source is upgrading.e.g. only change the source table is enough or I need to focus on other animals. I feel she's boiling down to create a separate source for R12 adapter.
Kind regards
SnehotoshFirst open the designer-> models and check which model has got the mapping of the eBS. Get this code with this TERRIBLE application
SELECT count (distinct i_pop) of SNP_POP_COL
where I_POP_COL in
(
Select i_pop_col in the SNP_POP_MAPPING where i_source_tab
in
(
Select i_source_tab in the SNP_SOURCE_TAB where i_table in)
Select i_table in the SNP_TABLE where I_MOD in
(select i_mod in the SNP_MODEL where mod_name = "PUT_HERE_YOUR_NAME")
)
)
);Will not consider some other influence (i.e. the procedure), it will be an indicator of average first level.
-
Behavior when the BootP table is empty
What is the behavior of a cFP-2220, if it is configured to use DHCP and it gets a contact with a BOOTP server, which happens to have a cleared BOOTP table? Always starts the RT app (stop over TCP is set to False) and function normally, but with a link-local address?
Is there a difference between having online with a DHCP server and using a BOOTP server?
We have a case where one such controller seems to freeze upwards, the status LED starts flashing 4 times in a row. We cannot recreate it with a DHCP server.
(This particular case is a bit special because it also involves an application that will try to reconfigure the controller to static (using the System Configuration API 5.0) IP if it does not get a valid IP address in the DHCP boot AND it has a valid IP address of a previous start saved in an INI file, and it is difficult to say exactly when the accident occurred... But there is a difference in the startup behavior to predict?)
FYI - this issue is now explained and fixed in part in another thread here on the forum:
Maybe you are looking for
-
Link does not appear in the frame, but it will appear in the new tab or window
http://www.southernpersuasion.com I have maintained this site for years. Recently, rather than posting the photos on a photos storage provider and publish them to facebook, I've published on facebook and then related site (select the link to photos).
-
Stop the auto-answer Elite Silver
How to stop an entire head auto-répondre incoming calls? When he receives calls the voice begins to announce the call, but then it stops before finishing announcing incoming call number and establishes the call without notice. Is this normal?
-
WAV files as input for speech recognition?
Is it possible to use a wav (or mp3) file as input in the Vista speech recognition program and convert it to text? It doesn't have to be perfect, just enough close conversion.
-
Asked: Mouse Software for Windows 7 and Windows 8 a Trackball Explorer
I want to peronsalise my Trackball Explorer settings. However, I'm not sure if the original CD Intallation IntelliPoint 4.1 is compatible with Windows 7 (x 64) and Windows 8 (x 64). I was unable to locate the corresponding or software drivers online,
-
Cannot move the pointer of the mouse after pressing the key on the keyboard (touch pad)
everytime I press a key on my keyboard, I can't move the mouse for 1-2 seconds after you press the keys, ex: by pressing the w button, can't move the mouse just after.