detect the source procedure variables
Hi guys,.Suppose I have a procedure with the oracle of the source, and I give a simple query (SELECT TALK, BLAH TIME)
and on the target, I would use jython to process the data from the source.
1. is there a conclusion on the way in which we could get all the variables in the source?
2 is it possible to get the result from the query result set?
in the target control, I could send the value of the source query using such #TALK and #TIME setting
but I just can't understand how the result of the loop and get all the values of ranks
Thanks in advance
herl
Published by: user3918409 on June 29, 2009 03:49
Hello Heri,
It's much easier than you can imagine... None... In fact, as I understand it, you already have all necessary.
In an ODI procedure when a query of the source is used, it creates something as a "slider" which will execute the Code tab target once for each returned row.
I mean, iif your select return 4 rows, the target code (jhyton as you wish) will be executed 4 times.
The way to reference from the source variables is "#my_column_from_select" where "my_column_from_select" is the name or alias defined in the source query, and you must refer to each of them.
This help you?
Tags: Business Intelligence
Similar Questions
-
use the stored procedure VARIABLE in an ODI procedure
Hello
I have a stored procedure that takes custId as an input parameter and returns the age as output parameter.
custId is a varaible ODI that we spend during execution.
I want to insert the age value in a table.
declare
cust_age customer_details.age%type;
Start
FETCH_CUSTOMER_DATA(#Customer.CustomerID,cust_age);
end;
INSERT INTO CUSTOMER_AGE VALUES(#customerid,*cust_age*)
Thank you.Hello
Just use the insert in an ODI procedure in an anonymous pl/sql block.
I mean:
declare
cust_age customer_details.age%type;
Start
FETCH_CUSTOMER_DATA(#Customer.CustomerID,cust_age);
INSERT INTO CUSTOMER_AGE VALUES(#customerid,*cust_age*);
end;
Ok?
Cezar Santos
http://odiexperts.com -
Procedure of the ODI - Bind Variables in the conditional statements
In an ODI procedure, is it possible to add a conditional statement around bind variable? For example, if I use OdiOutFile as the command on the target and Oracle as the command on the Source, I can use bind variables to fill the data in this table (we are in fact using OdiInvokeWebService and passing a XML structure very complex, but it's easier for testing):
OdiOutFile-FILE = C: / TEST. TXT
< person >
< first > #FIRSTNAME < / first >
< Middle > #MIDDLENAME < / Middle >
< last > #LASTNAME < / last >
< / person >
It is a way to add a conditional statement using one of these bind variables? For example, if I wanted to test #MIDDLENAME null and null value, produced this portion of XML, such as:
OdiOutFile-FILE = C: / TEST. TXT
< person >
< first > #FIRSTNAME < / first >
< % if (#MIDDLENAME! = null) {% >}
< Middle > #MIDDLENAME < / Middle >
< %} % >
< last > #LASTNAME < / last >
< / person >
This type of scriptlet syntax seems to work fine, as long as the binding variable is not in the mix (if I put "true is true" or "true == false" in the case, it shows or does not show this line in the XML file, as expected). I use ODI 11.1.1.7.0
----------------------
Post edited by: KevinPratt
Thanks for the reply! As suggested, in what follows, I changed the command and it works as you want
OdiOutFile-FILE = C: / TEST. TXT-APPEND
< person >
< first > #FIRSTNAME < / first >
< @ if (!) (("#MIDDLENAME".equals(""))) {@ >}
< Middle > #MIDDLENAME < / Middle >
{< @} @ >
< last > #LASTNAME < / last >
< / person >
Using the syntax <@ ...="" @="">serve your purpose. Also, I think you might want to include the variable binding in the quotation to avoid syntax errors.
@>
-
Hi all
My name is Alessandro and I am new to the community.
I have a problem with the KM stage custom when I try to pass the variable from the source to the target.
The ODI version tha I use is the 11.1.1.5.0.
I created a stage KM following the instructions of the metalink document (Doc ID 728636.1).
But when I insert the value of the variable in a test table, the value in a table is the name of the variable.
Where I'm wrong?
I am doing thi.
(1) create a step in my goal of shell sql source and javabin KM. In the source tab I get the value of a query, and the name "LAST_UPDATE" column.
In the target tab, I attribute to the variabile jv_last_update the value of the variable #LAST_UPDATE, with the same name in the selection column.
(2) I created a second stage where I insert into a table of the value of the variable jv_last_update (to debug the value of the variable):
(3) when I try to see what I have in the table, the value of any line is the name of the variable "#LAST_UPDATE"; ".
Thanks in advance
AlessandroHi Alessandro,.
Interesting... I have not read the Oracle document you sent yet, but one thing I can guarantee you, is that it doesn't. If Oracle says that it should work, maybe it's a bug, or maybe he has changed on new versions of ODI. I am also on ODI 11.1.1.5 and I tried many different ways to pass SQL results to variables of java with all sorts of different labels, but none of them worked for me as well. But I managed to use it in a different way, so please see below if it matches your needs:
We are just one step. The second is just to show that it worked:
In the first step, on the source tab, select Oracle and point to the logical schema that you want to run the query:
On the target, note the following Java BeanShell code with the SQL that you want to run:
Now your variable must have the correct value of your SQL. To test it, I just write a comment 'Raise' to Jython in the second step:
The result is 'X' as expected:
It will be useful.
Thank you!
-
Generic procedure to load the data from the source to the table target
Hi all
I want to create a generic procedure to load data of X number of the source table to X number of the target table.
such as:
Source1-> Target1
Source2-> Target2
-> Target3 Source3
Each target table has the same structure as the source table.
The indexes are same as well. Constraint are not predefined in the source or target tables.there is no involved in loading the data from the business logic.
It would simply add.
This procedure will be scheduled during off hours and probably only once in a month.
I created a procedure that does this, and not like:
(1) make a contribution to the procedure as Source and target table.
(2) find the index in the target table.
(3) get the metadata of the target table indexes and pick up.
(4) delete the index above.
(5) load the data from the source to the target (Append).
(6) Re-create the indexes on the target table by using the collection of meta data.
(7) delete the records in the source table.
sample proc as: (logging of errors is missing)
CREATE or REPLACE PROCEDURE PP_LOAD_SOURCE_TARGET (p_source_table IN VARCHAR2,
p_target_table IN VARCHAR2)
IS
V_varchar_tbl. ARRAY TYPE IS VARCHAR2 (32);
l_varchar_tbl v_varchar_tbl;
TYPE v_clob_tbl_ind IS TABLE OF VARCHAR2 (32767) INDEX OF PLS_INTEGER;
l_clob_tbl_ind v_clob_tbl_ind;
g_owner CONSTANT VARCHAR2 (10): = 'STG '.
CONSTANT VARCHAR2 G_OBJECT (6): = 'INDEX ';
BEGIN
SELECT DISTINCT INDEX_NAME BULK COLLECT
IN l_varchar_tbl
OF ALL_INDEXES
WHERE table_name = p_target_table
AND the OWNER = g_owner;
FOR k IN l_varchar_tbl. FIRST... l_varchar_tbl. LAST LOOP
SELECT DBMS_METADATA. GET_DDL (g_object,
l_varchar_tbl (k),
g_owner)
IN l_clob_tbl_ind (k)
FROM DUAL;
END LOOP;
BECAUSE me IN l_varchar_tbl. FIRST... l_varchar_tbl. LAST LOOP
RUN IMMEDIATELY "DROP INDEX ' |" l_varchar_tbl (i);
DBMS_OUTPUT. PUT_LINE (' INDEXED DROPED AS :'|| l_varchar_tbl (i));
END LOOP;
RUN IMMEDIATELY ' INSERT / * + APPEND * / INTO ' | p_target_table |
' SELECT * FROM ' | '. p_source_table;
COMMIT;
FOR s IN l_clob_tbl_ind. FIRST... l_clob_tbl_ind LAST LOOP.
EXECUTE IMMEDIATE l_clob_tbl_ind (s);
END LOOP;
RUN IMMEDIATELY 'TRUNCATE TABLE ' | p_source_table;
END PP_LOAD_SOURCE_TARGET;
I want to know:
1 has anyone put up a similar solution if yes what kind of challenges have to face.
2. it is a good approach.
3. How can I minimize the failure of the data load.
Why not just
create table to check-in as
Select "SOURCE1" source, targets "TARGET1", 'Y' union flag double all the
Select "SOURCE2', 'TARGET2', 'Y' in all the double union
Select "SOURCE3', 'Target3', 'Y' in all the double union
Select "SOURCE4', 'TARGET4', 'Y' in all the double union
Select 'Source.5', 'TARGET5', 'Y' in double
SOURCE TARGET FLAG SOURCE1 TARGET1 THERE SOURCE2 TARGET2 THERE SOURCE3 TARGET3 THERE SOURCE4 TARGET4 THERE SOURCE.5 TARGET5 THERE declare
the_command varchar2 (1000);
Start
for r in (select source, target of the archiving of the pavilion where = 'Y')
loop
the_command: = "insert / * + append * / into ' |" r.Target | ' Select * from ' | '. r.source;
dbms_output.put_line (the_command);
-execution immediate the_command;
the_command: = 'truncate table ' | r.source | "drop storage."
dbms_output.put_line (the_command);
-execution immediate the_command;
dbms_output.put_line(r.source ||) 'table transformed');
end loop;
end;
Insert / * + append * / into select destination1 * source1
truncate table SOURCE1 drop storage
Treated SOURCE1 table
Insert / * + append * / to select TARGET2 * in SOURCE2
truncate table SOURCE2 drop storage
Treated SOURCE2 table
Insert / * + append * / into select target3 * of SOURCE3
truncate table SOURCE3 drop storage
Treated SOURCE3 table
Insert / * + append * / into TARGET4 select * from SOURCE4
truncate table SOURCE4 drop storage
Table treated SOURCE4
Insert / * + append * / into TARGET5 select * from source.5
truncate table source.5 drop storage
Treated source.5 table
Concerning
Etbin
-
Required privilege to view the source code for the stored procedure
RDBMS Version: 11.2.0.4
Platform: Oracle Linux 6.4
In our Production database, we have an application schema named CRM_PROD. And we have a read-only user named steve in this PB.
Steve must be able to view the source code of all stored procedures, functions and packages in the CRM_PROD schema. But steve shouldn't be able to run these procedures, functions and packages in the CRM_PROD schema. What a privilege should give Steve for this?
SYS is owner of the dictionary of data and tables for the source code. See configuration of privilege and role authorization - 11 g Release 2 (11.2).
Select it no matter what dictionary grant will give user (read) access to the full data dictionary.
-
Get the source code of a procedure for a huge package in oracle
I have a package which, as methods of 40-50 in them, I would like to retrieve the source of one inside the package. is there a table where I can get this detail in the oracle database.
I know there is an all_source table, which has the entire source code, but I want to only get the source code for a particular procedure.
Thanks in advance.You have defined your procedure as provided
procedure procedure_name... ... end procedure_name;
and the procedure is not overloaded, you can try something as
with first_line as (select line from all_source where instr(lower(text),'procedure '||lower(:procedure_name)) > 0 and name = :package_name and type = 'PACKAGE BODY' and owner = :package_owner ), last_line as (select line from all_source where instr(lower(text),'end '||lower(:procedure_name)||';') > 0 and name = :package_name and type = 'PACKAGE BODY' and owner = :package_owner ), select text from all_source where line between (select line from first_line) and (select line from last_line) order by line
Concerning
Etbin
-
Need help with the procedure variable
Hi guys,.
I try to get the list of the TableName of a specific table and store it in a variable and use this variable to LOOP and remove specific data in the table. Here is my code, maybe that will be clearer...
This procedure within a package
PROCEDURE DeleteData (parCONTR_NBR IN VARCHAR2)
AS
v_TableName CMSR_MAPPING. TABLE_NAME % TYPE;
BEGIN
Extract the names of the tables
SELECT TABLE_NAME
IN v_TableName
OF CMSR_MAPPING
WHERE TABLE_TYPE <>'W '.
AND ORDER_SEQ <>' 0'
ORDER BY ORDER_SEQ DESC
;
-Loop on the name of the table
FOR v_Index in 1... v_TableName.Count LOOP
-Check that the table name and remove from the respectable table -.
CASE v_TableName (v_Index)
WHEN "CMSW_CONTR" THEN
REMOVE FROM CMSW_CONTR
WHERE CONTR_NBR = parCONTR_NBR;
WHEN "CMSW_AMNDS" THEN
REMOVE FROM CMSW_AMNDS
WHERE CONTR_NBR = parCONTR_NBR;
END CASE;
END LOOP;
END;
When I run it, I get the following compile on this line error of TO v_Index IN 1.. v_TableName.COUNT LOOP:
PLS-00487: Invalid reference to the variable 'V_TABLENAME '.
Can someone help with this? What I'm doing wrong here?Like this?
/* Formatted on 5/20/2011 12:37:05 PM (QP5 v5.149.1003.31008) */ CREATE OR REPLACE PROCEDURE DeleteData (parCONTR_NBR IN VARCHAR2) IS BEGIN FOR c IN ( SELECT TABLE_NAME v_TableName FROM CMSR_MAPPING WHERE TABLE_TYPE != 'W' AND ORDER_SEQ != '0' ORDER BY ORDER_SEQ DESC) LOOP -- Verify the table name and delete in respectable table -- --( I always hate when my tables aren't respectable !) CASE c.v_TableName WHEN 'CMSW_CONTR' THEN DELETE FROM CMSW_CONTR WHERE CONTR_NBR = parCONTR_NBR; WHEN 'CMSW_AMNDS' THEN DELETE FROM CMSW_AMNDS WHERE CONTR_NBR = parCONTR_NBR; END CASE; END LOOP; END;
Obviously I don't have your data and do not know exactly what is the whole procedure
but you could not do?/* Formatted on 5/20/2011 12:49:07 PM (QP5 v5.149.1003.31008) */ CREATE OR REPLACE PROCEDURE DeleteData (parCONTR_NBR IN VARCHAR2) IS BEGIN DELETE FROM CMSW_CONTR WHERE CONTR_NBR = parCONTR_NBR AND EXISTS (SELECT 1 FROM CMSR_MAPPING WHERE TABLE_TYPE != 'W' AND ORDER_SEQ != '0' AND table_name = 'CMSW_CONTR'); DELETE FROM CMSW_AMNDS WHERE CONTR_NBR = parCONTR_NBR AND EXISTS (SELECT 1 FROM CMSR_MAPPING WHERE TABLE_TYPE != 'W' AND ORDER_SEQ != '0' AND table_name = 'CMSW_AMNDS'); END;
Published by: pollywog may 20, 2011 12:49
-
Execution of the different procedure to the variable...
Run the following procedure is different if I put the value of the P_LOT variable and use it in the first selection stmt (AS shown). Or if I replace it in the stmt with the value of the parameter directly. (that is, replace P_LOT with "2148" in the first select stmt). The instructions of output show that the value of the variable is correct. I use DB 11g R2. Help, please.
Set serveroutput on;
DECLARE
NUMBER OF P_FID;
P_LOT VARCHAR2 (10);
cuser_one varchar2 (25);
cuser_two varchar2 (25);
cuser_three varchar2 (25);
RecordCount number;
BEGIN - party executable begins here
P_LOT: = '2148';
P_FID: = 206247;
dbms_output.put_line (P_LOT);
SELECT Count (LOTNO) IN RecordCount
OF IQMS. TRANSLOG
WHERE TRANSLOG. LOTNO = P_LOT
AND FGMULTI_CUSER1 IS NOT NULL
AND FGMULTI_CUSER2 IS NOT NULL
AND FGMULTI_CUSER3 IS NOT NULL
AND ROWNUM < 2;
dbms_output.put_line (P_LOT);
dbms_output.put_line (RecordCount);
IF (CpteEnregistrement > 0) THEN
dbms_output.put_line ("'In the loop");
SELECT
FGMULTI_CUSER1, FGMULTI_CUSER2, FGMULTI_CUSER3
IN
cuser_one, cuser_two, cuser_three
Of
IQMS. TRANSLOG
WHERE TRANSLOG. LOTNO = "2148"
AND FGMULTI_CUSER1 IS NOT NULL
AND FGMULTI_CUSER2 IS NOT NULL
AND FGMULTI_CUSER3 IS NOT NULL
AND ROWNUM < 2;
UPDATE IQMS. FGMULTI GAME
CUSER1 = cuser_one,
CUSER2 = cuser_two,
CUSER3 = cuser_three
WHERE ID = P_FID;
END IF;
END;
Published by: user13317821 on March 16, 2011 07:12
Published by: user13317821 on March 16, 2011 07:16
Published by: user13317821 on March 16, 2011 07:19It makes more sense. This is your problem:
SQL> CREATE TABLE t (lot_no CHAR(10)); -- note the datatype Table created. SQL> insert into t values ('2910'); 1 row created. SQL> commit; Commit complete. SQL> DECLARE 2 p_lot VARCHAR2(10) := '2910'; -- note the datatype 3 l_cnt NUMBER; 4 BEGIN 5 SELECT count(*) INTO l_cnt 6 FROM t 7 WHERE lot_no = p_lot; 8 DBMS_OUTPUT.Put_Line('count is: '||l_cnt); 9 END; 10 / count is: 0 SQL> DECLARE 2 p_lot VARCHAR2(10) := '2910'; 3 l_cnt NUMBER; 4 BEGIN 5 SELECT count(*) INTO l_cnt 6 FROM t 7 WHERE lot_no = '2910'; 8 DBMS_OUTPUT.Put_Line('count is: '||l_cnt); 9 END; 10 / count is: 1
Oracle stores the right CHAR data types padded spaces to the defined length. When comparing a literal string (such as '2910') Oracle will be also the string literal key. It does not when you compare a variable binding as in your case.
You must do this:
SQL> DECLARE 2 p_lot CHAR(10) := '2910'; -- note the datatype 3 l_cnt NUMBER; 4 BEGIN 5 SELECT count(*) INTO l_cnt 6 FROM t 7 WHERE lot_no = p_lot; 8 DBMS_OUTPUT.Put_Line('count is: '||l_cnt); 9 END; 10 / count is: 1
Or generally better style
variable table.column%Type;
Better would be to not use the CHAR data type at all, always use VARCHAR2 instead.
John
-
Location of the source code for the procedure of ODI
Let say I have a SQL code located in the ODI process (well, I know it's a bad habit, sorry).
How can I find if I don't remember the name of procedure?
The code must be located somewhere in the repository of the work, right?
But what is the name of table?
As I can SELECT * FROM odiw.xxxx, WHERE xxxx like '% text_i_am_looking_for %';
Or maybe there is a better way to do it?All the information KM and ODI procedure are stored in SNP_TRT and then link to SNP_LINE_TRT where all the steps in the procedure are stored.
then bind to SNP_LINE_TRT. DEF_I_TXT for control of target and SNP_LINE_TRT technology. COL_I_TXT the order of the source technology and properly link to SNP_TXT. Order I_TXT of TXT_ORD and SNP_TXT. TXT is where you will be able to find the syntax or SQL code. -
How to calculate the variable on the target, but use the value on the source?
Hi ODI gurus!
I use LKM MS SQL for Oracle (bcp-> sqlldr).
I have a variable which is calculated from tables on the target DB (oracle).
I would use this calculated value in the filter on the source, but I get error ODI is refreshing to variable on the source database.
It is possible to update value of variable on the target technology and using calculated value on the source technology?
Thanks in advance!Step 1. In the variable - > refreshing tab - > select the schema and the application required for the Oracle database, so you when you refresh the variable, you get the desired result (for example, the ex - value 25 or whatever you are looking for)
step 2. Call this variable in the Source filter, where the table_source. COLUMN = #VARIABLE_NAME
Step 3. Call the Variable in refreshing mode, call the interface.
So that when the variable is updated to the value that is passed and the source table to get the value of its filter.If you do pretty much the same things, can you please paste the error, query and your filter condition. So that we can guide you accordingly.
-
How to use the variable in the path of the source of an image in flex
Hello
I just want to know that how to use the variable in the path of the source of an image in flexHello
I just want to know that how to use the variable in the path of the source of an image in flex -
Get the CGI env variables in a database procedure using the new listener to the APEX
I already posted this question in the earpiece of the Apex forum and still no response after a week. The original post is here:
So please forgive me for posting in this forum as well, but there is much more activity here.
I would like to know how I can get the CGI environment to the listener of the APEX. For example, if I want to write a procedure that inserts into a table, the client web request originating IP address, how do it?
I am familiar with the Oracle Http Server and mod_plsql, and I know how to call OWA_UTIL. GET_CGI_ENV to get this kind of information. How can I do this by using the earpiece of the APEX?
In particular, how to do that when you call a custom (not in a workspace Apex) procedure? When I try now, I get an error owa_util. The cgi env seems to be empty or not initiated (owa.num_cgi_vars is null or zero).
Specific settings:
I have a web server running the last JDK, Glassfish and 1.1.4 Apex listener. It connects to another server running the last database 11.2. Apex is installed and running, but I'm not really developing a traditional Apex application in a workspace. I use it mainly as you would use mod_plsql. In other words, I have packages of pl/sql custom which are called directly via a URL. Applications must be sent by the listener to the database and DB executes the procedure and returns output using htp.p to send the text to the browser. And it works very well for this purpose. But if I want to call GET_CGI_ENV to get information such as IP address, the browser making the request, etc. I can't get with the OWA packages.
Anyone can shed some light on this? If the listener of the Apex is not designed to do this, is it some kind of workaround that I can use to transfer such information to the database for each request?Hi Adam,.
APEX is located on the top of the Toolbox for OWA. There is no appeal of the special procedure to be implemented.
Kind regards
Christian -
Automatically runs the integration procedure when arrives to the new file source csv
Hello
I have a few steps to integrate my data defined as steps in the odi package. All data will be loaded from csv file, located in the source directory. End users will have access smb to the end of the file, they will be able to put the new csv (with a valid, defined name) in this folder. Thus, odi must periodically check if the new file happened and if the new file has been found - my packege should be performed. Or alternatively - package can run periodically and check if the source file exists if so the data should be integrated.
What is the best way to do it?I'd do a package starting with a stage of ODIWaitForFile;).
You can find this tool in the Toolbox on the left. -
Capacity/size of the detected incorrectly source Volume
I'm just getting started with VMware vCenter Converter Standalone, and I was able to successfully create the two vm (AFAIK, I've not started them yet), but when I go to create the virtual machine for the third system it shows the volume of the source as 8338896085 GB. The current hard drive is only 34.4 GB, with 20.7 GB free.
The system is:
Windows 2000 Advanced Server (5.00.2195) Service Pack 4
2 Intel Xeon 2.8 GHz HT
1 GB OF RAM
Any suggestions on how to get around this are appreciated.
Thank you
seems like it might be a driver problem
http://communities.VMware.com/thread/188002?TSTART=600
http://communities.VMware.com/message/673475#673475
will try tomorrow and see how it goes.
Maybe you are looking for
-
AppleID asks a password for an ID that does not exist
When I try to update my apps on my phone I wonder to enter a password for an AppleID that does not exist. I am connected and can't seem to download applications, but not updated. I don't have this problem with my iPad using the same account, just th
-
DVD/CD burner is not recognized by XP on my Satellite Pro U300
I just bought a Toshiba U300 Satellite Pro with Vista installed :-(. For my work, I need to use software that is not compatible with Vista... so I installed my XP - pro software.I ran Windows Update a few times, until there is nothing to update.I ins
-
Scan multiple pages without using desktop
Hello I bought a desire 110 wireless to in a different place than my desktop. Sometimes I need to scan several pages, but it seems that the only way to accomplish a pdf normal multipage instead of several pdf files each containing a single page is to
-
I've been online before and I tried to see if replace works. I reinstalled it and it didn't work. I was wondering maybe if the ESO server is down? On my online titans expansion I already had a problem to go online and receive a different error, now w
-
Need of 90 MB of free but can't get into the settings
Hi all I have the 8 GB with 4 GB card, I use kubuntu as my o/s. I have not updated the firmware which is out of the box. My problem is that I tried to use my card as a USB and copy some TV shows for my friend. This caused my Dolphin (for example Expl