Insert generic value in the target table
Hi allI'm loading of data from source to target table orcle...
I would like to load one of the columns target with a big generic unique number that does not come from source...
the number in the target column should be likw...
35343834393533363533343934323539,
35343834393533363533343934323540,
35343834393533363533343934323541,
35343834393533363533343934323542,
35343834393533363533343934323543,
35343834393533363533343934323544
Concerning
"" "You're almost there. '"
Please use capital letters when you access oracle objects.
< %="odiRef.getObjectName" (« l »,="" « xref_data_sequence »,="" « d »)="" %="">.nextval
This works...
Tags: Business Intelligence
Similar Questions
-
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.
- You cannot specify
-
Interface - value in the target field change on insert/update
Hello
For an interface, I use the module knowledge - incremental update of the IKM Oracle.
He is running in insert / update of fashion.
In the target of the interface table, there is a the target field (column) that I want to give a value based on exploitation.
If the file is new and inserted into the target table - the field in the record should get the value "INSERT".
-Similarly, if an existing record in the target table is updated - the field of the record should get the value "UPDATE".
Any ideas on how you can do it?
Thank you.You just need to customize your KM. Its can be done in many ways. Here is one approach.
Change the existing lines of your update. Then change as below. But make you your own customization without hard coding.
Here is codes, the fraction of the total code used in the KM steps.if="" (1="=2<% out.print( odiRef.getColList( "|| 1==1 ", " ", "", "", "((UPD AND (NOT UK) AND ( NOT TRG)) AND REW)" ));%>){"?>(
<%=odiRef.getColList("", "T.[COL_NAME]", ",\n\t", "", "((UPD AND (NOT UK) AND (NOT TRG)) AND REW)")%>
*, COL_FLAG. *
) =
(
Select < %="odiRef.getColList" ("«,="" « s.="" [column] », »,="" \n\t\t\t »,="" « »,="" « ((upd="" et="" (pas="" uk)="" et="" (pas="" trg))="" et="" rew) »)="" %=""> *, "UPDATE."
of< %="odiRef.getTable" ("l",="" "int_name",="" "w")="" %="" >="">
where< %="odiRef.getColList" ("",="" "t.="" [column]="S." [column]",="" "\n\t\tand\t",="" "",="" "uk")="" %="">
) };=""?>Similarly for new lines inserted
insert into <%=odiRef.getTable("L","TARG_NAME","A")%> T
(
<%=odiRef.getColList("", "[COL_NAME]", ",\n\t", "", "((INS AND (NOT TRG)) AND REW)")%>
<%=odiRef.getColList(odiRef.getColList(",", " ", "", "", "((INS and !TRG) and REW)"), "[COL_NAME]", ",\n\t", "", "((INS AND TRG) AND REW)")%>
*, COL_FLAG. *
)
Select< %="odiRef.getColList" (" »,="" « [column]="" «, »="" \n\t »,="" « »,="" « ((ins="" et="" (pas="" trg))="" et="" rew) »)="" %="">
< %="odiRef.getColList" (odiref.getcollist="" («, »,="" "«,="" « »,="" « »,="" « ((ins="" and !="" trg)="" et="" rew) »),="" « [expression]="" «, »="" \n\t »,="" « »,="" « ((ins="" and="" trg)="" et="" rew) »)="" %="">*, "INSERT."of <%=odiRef.getTable("L","INT_NAME","W")%> S
It should work. Your target must have the column as "COL_FLAG" and do nothing for this column in the map interface.
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 = -
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 -
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.
-
How to assign values to the nested table and passes as a parameter for the procedure?
How to assign values to the nested table and passes as a parameter for the procedure?
Here are the object and its type
create or replace type test_object1 as an object
(
val1 varchar2 (50).
val2 varchar2 (50).
VARCHAR2 (50) val3
);
create or replace type test_type1 is table of the test_object1;
create or replace type test_object2 as an object
(
val1 varchar2 (50).
val2 varchar2 (50).
VARCHAR2 (50) val3
);
create or replace type test_type2 is table of the test_object2;
GRANT ALL ON test_object1 to PUBLIC;
GRANT ALL ON test_type1 to PUBLIC;
GRANT ALL ON test_object2 to PUBLIC;
GRANT ALL ON test_type2 to PUBLIC;
Here is the table object type:
create the table test_object_tpe
(
sl_num NUMBER,
Description VARCHAR2 (100),
main_val1 test_type1,
main_val2 test_type2
)
NESTED TABLE main_val1 STORE AS tot1
NESTED TABLE main_val2 STORE AS earlier2;
-----------------------------------------------------------------------------------------------------------
Here is the procedure that inserts values into the nested table:
PROCEDURE INSERT_TEST_DATA (sl_num in NUMBER,
Description in VARCHAR2,
p_main_val1 IN test_type1,
p_main_val2 IN test_type2
)
IS
BEGIN
FOR rec in p_main_val1.first... p_main_val1. Last
LOOP
INSERT INTO xxdl.test_object_tpe
(
sl_num,
Description,
main_val1,
main_val2
)
VALUES
(
sl_num
description
test_type1 (test_object1)
p_main_val1 .val1 (CRE),
p_main_val1 .val2 (CRE),
p_main_val1 .val3 (rec)
)
)
test_type2 (test_object2 (p_main_val2 .val1 (CRE),
p_main_val2 .val2 (CRE),
p_main_val2 .val3 (rec)
)
)
);
END LOOP;
commit;
END INSERT_TEST_DATA;
-------------------------------------------------------------------------------------------
Here are the block anonymoys what values attributed to the object type and pass values in the procedure:
Set serveroutput on;
declare
p_sl_num NUMBER: = 1001;
p_description VARCHAR2 (50): = 'Test Val1;
inval1 test_type1: = test_type1();
inval2 test_type2: = test_type2();
Start
inval1 (1) .val1: = "testx1";
inval1 (1) .val2: = "testx2";
inval1 (1) .val3: = "testx3";
inval2 (1) .val1: = "testy1";
inval2 (1) .val2: = "testy2";
inval2 (1) .val3: = "testy3";
CSI_PKG. INSERT_TEST_DATA (sl_num = > p_sl_num,)
Description = > p_description,
p_main_val1 = > inval1,
p_main_val2 = > inval2
);
end;
/
Someone can correct me.
Thank you
LavanThanks for posting the DOF and the sample code but whenever you post provide your Oracle version 4-digit (result of SELECT * FROM V$ VERSION).
>
How to assign values to the nested table and passes as a parameter for the procedure?
>
Well you do almost everything bad that could be hurt.Here is the code that works to insert data into your table (the procedure is not even necessary).
declare p_sl_num NUMBER := 1001; p_description VARCHAR2(50) := 'Testing Val1'; inval1 test_type1 := test_type1(); inval2 test_type2 := test_type2(); begin inval1.extend(); inval1(1) := test_object1('testx1', 'testx2', 'testx3'); inval2.extend(); inval2(1) := test_object2('testy1', 'testy2', 'testy3'); INSERT INTO test_object_tpe ( sl_num, description, main_val1, main_val2 ) VALUES (p_sl_num, p_description, inval1, inval2); commit; end; /
See example 5-15 making reference to an element of nested Table Chapter 5 using PL/SQL collections and records in the PL/SQL doc
http://docs.Oracle.com/CD/B28359_01/AppDev.111/b28370/Collections.htm#CJABEBEA1. you don't even have the procedure because it is a simple INSERTION in the table you can do directly (see my above code)
inval1(1).val1 := 'testx1';
Since you have not yet created all the elements, there is no element 1 "inval1". You need EXTEND the collection to add an element
inval1.extend();
And then, there is an empty element, but "inval1" is a container for objects of type 'test_object1' not for scalars as "val1", "val2", and "val3".
If you can not doinval1(1).val1 := 'testx1';
You must create an instance of 'test_object1 '.
inval1(1) := test_object1('testx1', 'testx2', 'testx3');
And so on for the other collection
You don't need the procedure (as my code example shows), but once you fill in the variables correctly it will work.
-
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
-
Insert some values into the database of field boxes
I had a similar probem and error when you use the drop-down list instead of a checkbox. It was solved by putting the SELECT name = "CarMake in the menu dropdown.
But in the box, I don't know?
I seem that the problem is the action page has the Form.carmake, but the page does not work. What Miss me and where should I put in the entry below page.
The main objective is to have checked checkboxes to insert some values into the database field carmake based on what is checked.
If the Honda checkbox is checked then
It inserts into the carmake field value Honda.
If the Toyota checkbox is checked then
It inserts into the carmake field the value of Toyota.
If both are true then 2 rows are inserted two values
Honda and Toyota.
Ditto for the last option.
Thanks for your help
Here's the error again
error:
Error occurred while processing request
CARMAKE element is not defined in the FORM.
12:21:50.050 - term Exception - in C:\CFusionMX7\wwwroot\Author\CarAddAction.cfm: line 16
CARMAKE element is not defined in the FORM.
line 16 is:
"#Trim (Form.carmake), #
Join the Code
<! - Here is the form - >
< html >
< head >
< / head >
< body >
< h1 > < / h1 >
< table >
< action = "CarAddAction.cfm cfform" method = "POST" > "
< b >
< td > Honda: < table >
< td > < Center > < input type = "checkbox" name = "HONDA_MODEL" value = "HONDA" checked > < / center > < table >
< /tr >
< b >
< td > Toyota: < table >
< td > < Center > < input type = "checkbox" name = "Toyota_MODEL" value = "Toyota" Unchecked > < / center > < table >
< /tr >
< b >
< td > SUBARU: < table >
< td > < Center > < input type = "checkbox" name = "SUBARU_MODEL" value = "SUBARU" unchecked > < / center > < table >
< /tr >
< Tr > < td > < table > Honda model
< td >
< input type = "Text".
name = "Honda_Model".
Value =""
size = "22".
MaxLength = "20" >
< table >
< tr > < /tr >
< Tr > < td > < table > Toyota model
< td >
< input type = "Text".
name = "Toyota_Model".
Value =""
size = "22" >
< table >
< tr > < /tr >
< Tr > < td > < table > Subaru model
< td >
< input type = "Text".
name = "Subaru_Model".
Value =""
size = "22" >
< table >
< tr > < /tr >
< td > < table >
< td >
< input type is 'submit' value is "Take Add to database" >
< table >
< /tr >
< / cfform >
< /table >
< / body >
< / html >
<!-action page
--------->
< cfdump var = "#form #" >
< name cfquery = "InsertCarInfo."
DataSource = "#request. MainDSN #">"
INSERT INTO Car_tab)
car_Make,
Honda_Model,
Toyota_Model,
Subaru_Model
)
VALUES)
"#Trim (Form.carmake), #
"#Trim (Form.Honda_Model), #
"#Trim (Form.Toyota_Model), #
"#Trim (Form.Subaru_Model) #
)
< / cfquery >
You check in one or more of the boxes before continuing? Remember what I said about the form field box existing only on the page of treatment at least 1 or more checkboxes are checked on your form. Make sure you use
to avoid this problem. What happens when you take a look at the output of your dump of form? Your fields are present?
-
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
-
How to fill the value in the nested table by using the object type
Hi gurusI created an object type and able to fill the values in it, now I want to create a nested table type of this object and fill it but looks like I'm doing something wrong, see my code below.
Code example
CREATE or REPLACE TYPE countries_o
AS
OBJECT
(
COUNTRY_ID TANK (2 BYTES),
COUNTRY_NAME VARCHAR2 (40 BYTE),
REGION_ID NUMBER);
/create or replace type countries_t is table of the countries_o;
/CREATE OR REPLACE
ABC of the PROCEDURE
IS
v_print countries_t; -: = arr_countries_t('01','Aus',1);
BEGIN
v_print: = countries_t('01','A',11);
DBMS_OUTPUT. Put_line (v_print. COUNTRY_ID | v_print. COUNTRY_NAME | v_print. REGION_ID);
END;
/
Error
- Error (6.3): PL/SQL: statement ignored
- Error (6,12): PLS-00306: wrong number or types of arguments in the call to 'COUNTRIES_T '.
- Error (7.3): PL/SQL: statement ignored
- Error (7.32): PLS-00302: component 'COUNTRY_ID' must be declared
Thanks in advance
Concerning
Muzz
Hi user,
Here is another method that you can try-
CREATE OR REPLACE
ABC of the PROCEDURE
IS
v_print countries_t: = countries_t (countries_o('01','A',11));
BEGIN
DBMS_OUTPUT. Put_line (v_print (1).) COUNTRY_ID | v_print (1). COUNTRY_NAME | v_print (1). REGION_ID); -you're accessinf the first element of the nested table, which in turn points to the object.
END;
In the sections of the declaration you have assigned values to the nested table.
Kind regards
Maxou - Error (6.3): PL/SQL: statement ignored
-
Referencing of the values of the dynamic tables
Hi you all!
I am building a form for one of my clients. It is divided into three languages depending on who fills out the form.
You can start of Poland then switch to English and watch that all filled. Someone else can do the same thing
but starts of English and following pages in Polish. There is also a German part in it.
Previously, it was a static form for each value had been spread between parts of a document
by linking it as global.
Now I have a dynamic PDF with dynamic arrays. I have to generate rows in the same table
in each languages part and a person who can go to any language (part of the document).
I enclose a small example of two subforms. Each represents the different language version. Buttons
each of them can add rows in both tables at the same time.
I tried to write formulas for cells to Exchange data between. In this example, this works. When I import these
subforms in my real paper, that it stops working.
How can I bind values between cells of these tables to use both ways, from any of them?
Any part must copy a value of corresponding cells, both ways.
http://strony.Aster.pl/Wystawa/www/tables_example.PDF
Kind regards
Sylwester Zacheja
Hello
There is here an example that might be of help to you: https://acrobat.com/#d=hkeDKn6SRo1FAvFUoY6Smw
If you look at the script in the second print button, you will see how she fills in the values of the visible table to a hidden table.
Also this example can help: https://acrobat.com/#d=z9JRAb-7bKkdBwRHM4EHGw
Niall
-
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.
-
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.
-
Set a default value in the target?
Hi experts,
How can I set a default value in the target data store that I'll use in the interface?Hello
Open your store of target data column, click the Description tab and the default value is
. Then in the interface, select this column and go to run on the TARGET.
Implementing tab say, odiRef.getColDefaultValue)
Thank you
G
Maybe you are looking for
-
Satellite A110 - cannot find the drivers from the view
Greetings, I have a problem and I have not found any thread related to my problem. I have a laptop Toshiba Satellite A110 and requires some updates which I can't find on the internet or on the Toshiba site. Device Manager indicates that the following
-
How to combine 3rd party install and install generated by LabVIEW?
I am developing a software that controls a thermal regulator via a USB cable connection. I use NI-VISA to communicate with him. The controller uses a USB chip, for which a 3rd party USB driver is necessary. (I downloaded from here: http://www.ftdichi
-
I can only burn a song on a cd after burning a song it will finalize the disc I use blank cd - r
I have a sony pc and he was burning full cd but it stop working and it burns only now a song on a cd
-
Jabber comments does not work with Expressway 8.7.2
Hello the last Highway requires Diffie-Hellman keys at least 1024 bits in size. Unfortunately comments Jabber always uses 768bits as the 'server Temp key' on tomcat. This is why you cannot use Jabber comments (any version; I tried 10.6.9 and 10.6.10)
-
implementation of WORK for our clients
Hi all. We are running Oracle 11 GR 2 running Solaris 10.I have a database configured, but not yet configured physical standby for FSFO.I will be the DGBroker to failover faststart but also need to understand how to configure the clients to automatic