ODI procedure error
Hi,
I m getting error while running following query in procedure.Please help me to overcome the problem.
SELECT TRIM (FTP_TARGET_LOC) ftp_tgt_loc,
TRIM (FTP_SERVER) ftp_server_ip,
TRIM (FTP_USERID) ftp_userid,
TRIM (FTP_PASSWORD) ftp_passwd,
TRIM (FTP_SOURCE_DIRECTORY) ftp_src_dir,
TRIM (FTP_TARGET_DIRECTORY) ftp_tgt_dir,
TRIM (src_file_nm) src_file_nm,
TRIM (FTP_TYPE) ftp_type,
TRIM (FTP_DATA_FILE_NM) trgt_file_nm,
'#GLOBAL.g_FTP_FILE_DEL_IND' del_ind,
zip_ind zip_ind,
TRIM (UNIQUE_ARCH_ID_IND) arch_ind,
TRIM (ARCHIVE_DIRECTORY) arch_dir,
'#GLOBAL.g_ADM_ETL_XML_FILE_NM' del_fil
FROM ODIADM.FTP_PARAMETER
WHERE FTP_TARGET_LOC = '#GLOBAL.g_FTP_TGT_LOC'
Error message:
923 : 42000 : java.sql.SQLException: ORA-00923: FROM keyword not found where expected
java.sql.SQLException: ORA-00923: FROM keyword not found where expected
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:745)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:219)
at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:813)
at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1049)
at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:854)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1154)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3370)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3415)
at com.sunopsis.sql.SnpsQuery.executeQuery(SnpsQuery.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execCollOrdersOSOder(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSqlS.treatTaskTrt(SnpSessTaskSqlS.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
at com.sunopsis.dwg.cmd.DwgCommandScenario.treatCommand(DwgCommandScenario.java)
at com.sunopsis.dwg.cmd.DwgCommandBase.execute(DwgCommandBase.java)
at com.sunopsis.dwg.cmd.e.k(e.java)
at com.sunopsis.dwg.cmd.g.G(g.java)
at com.sunopsis.dwg.dbobj.SnpScen.a(SnpScen.java)
at com.sunopsis.dwg.dbobj.SnpScen.localExecuteSync(SnpScen.java)
at com.sunopsis.dwg.tools.StartScen.actionExecute(StartScen.java)
at com.sunopsis.dwg.function.SnpsFunctionBaseRepositoryConnected.execute(SnpsFunctionBaseRepositoryConnected.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execIntegratedFunction(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSqlS.treatTaskTrt(SnpSessTaskSqlS.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
at com.sunopsis.dwg.cmd.DwgCommandSession.treatCommand(DwgCommandSession.java)
at com.sunopsis.dwg.cmd.DwgCommandBase.execute(DwgCommandBase.java)
at com.sunopsis.dwg.cmd.e.k(e.java)
at com.sunopsis.dwg.cmd.h.A(h.java)
at com.sunopsis.dwg.cmd.e.run(e.java)
at java.lang.Thread.run(Thread.java:595)
794771 wrote:
Hi,
I m getting error while running following query in procedure.Please help me to overcome the problem.
SELECT TRIM (FTP_TARGET_LOC) ftp_tgt_loc,
TRIM (FTP_SERVER) ftp_server_ip,
TRIM (FTP_USERID) ftp_userid,
TRIM (FTP_PASSWORD) ftp_passwd,
TRIM (FTP_SOURCE_DIRECTORY) ftp_src_dir,
TRIM (FTP_TARGET_DIRECTORY) ftp_tgt_dir,
TRIM (src_file_nm) src_file_nm,
TRIM (FTP_TYPE) ftp_type,
TRIM (FTP_DATA_FILE_NM) trgt_file_nm,
'#GLOBAL.g_FTP_FILE_DEL_IND' del_ind,
zip_ind zip_ind,
TRIM (UNIQUE_ARCH_ID_IND) arch_ind,
TRIM (ARCHIVE_DIRECTORY) arch_dir,
'#GLOBAL.g_ADM_ETL_XML_FILE_NM' del_fil
FROM ODIADM.FTP_PARAMETER
WHERE FTP_TARGET_LOC = '#GLOBAL.g_FTP_TGT_LOC'
Error message:
923 : 42000 : java.sql.SQLException: ORA-00923: FROM keyword not found where expected
java.sql.SQLException: ORA-00923: FROM keyword not found where expected
Make sure all of your Global variable is getting proper value before those are used inside your procedure
Similar Messages
-
ODI Procedure error log syntax
hi
I need to call an odi procedure and an error log needs to be stored on an error table.
I have created an ODI procedure and in command on source select Oracle as technology and the logical schema
here I put
DECLARE
ODI_VAR VARCHAR2(4000);
BEGIN
select ( '<%=odiRef.getPrevStepLog( "MESSAGE" )%>') into ODI_VAR from dual;
END;
and in target tab.
Insert into ERROR_LOG (TASK_NAME,ERROR_DESCRIPTION)
Values ('test','ODI_VAR');
AFTER executing I am getting the below error
900 : 42000 : java.sql.SQLSyntaxErrorException: ORA-00900: invalid SQL statement
java.sql.SQLSyntaxErrorException: ORA-00900: invalid SQL statement
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:457)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:397)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:389)
at oracle.jdbc.driver.T4CTTIfun.processError(T4CTTIfun.java:662)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:476)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:204)
at oracle.jdbc.driver.T4C8Odscrarr.doODNY(T4C8Odscrarr.java:101)
at oracle.jdbc.driver.T4CPreparedStatement.doDescribe(T4CPreparedStatement.java:848)
at oracle.jdbc.driver.OracleStatement.describe(OracleStatement.java:5331)
at oracle.jdbc.driver.OracleResultSetMetaData.<init>(OracleResultSetMetaData.java:58)
at oracle.jdbc.driver.OracleResultSetImpl.getMetaData(OracleResultSetImpl.java:274)
at oracle.odi.runtime.agent.execution.sql.concurrent.FastJDBCRecordSet.<init>(FastJDBCRecordSet.java:73)
at oracle.odi.runtime.agent.execution.sql.SQLDataProvider.readData(SQLDataProvider.java:97)
at oracle.odi.runtime.agent.execution.sql.SQLDataProvider.readData(SQLDataProvider.java:1)
at oracle.odi.runtime.agent.execution.DataMovementTaskExecutionHandler.handleTask(DataMovementTaskExecutionHandler.java:67)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.processTask(SnpSessTaskSql.java:2906)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java:2609)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatAttachedTasks(SnpSessStep.java:537)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:453)
at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:1740)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$2.doAction(StartSessRequestProcessor.java:338)
at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:214)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:272)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$0(StartSessRequestProcessor.java:263)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$StartSessTask.doExecute(StartSessRequestProcessor.java:822)
at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:123)
at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$2.run(DefaultAgentTaskExecutor.java:82)
at java.lang.Thread.run(Thread.java:662)
Please help me to resolve this issue.Hi,
Try like this :
Command on source :
select ( '<%=odiRef.getPrevStepLog( "MESSAGE" )%>') ODI_VAR from dual
Command on target:
Insert into ERROR_LOG (TASK_NAME,ERROR_DESCRIPTION)
Values ('test',:ODI_VAR)
Use the above syntax as it is....it should work.......... -
Hi Experts,
I have created following procedure and triyng to get column value by using rownum. When I run the scenario, I am getting following exception at ODI Procedure step. Can any one please help me on it
I have created loop package to fetch column value until loop end.
Please let me know if you are not clear my query
ODI Procedure:
begin
select a.eno into '#EMPNO' from (select rownum r,e.* from trg_emp_01 e) a where a.r=#Counter;
end;
#EMPNO variable created as alphanumeric datatype and
#Counter variable created as alphanumic datatype and it is assign with '1' value
Exception:
6550 : 65000 : java.sql.SQLException: ORA-06550: line 1, column 25:
PLS-00220: simple name required in this context
ORA-06550: line 1, column 28:
PL/SQL: ORA-00904: : invalid identifier
ORA-06550: line 1, column 7:
PL/SQL: SQL Statement ignored
java.sql.SQLException: ORA-06550: line 1, column 25:
PLS-00220: simple name required in this context
ORA-06550: line 1, column 28:
PL/SQL: ORA-00904: : invalid identifier
ORA-06550: line 1, column 7:
PL/SQL: SQL Statement ignored
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:316)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:282)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:639)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:185)
at oracle.jdbc.driver.T4CPreparedStatement.execute_for_rows(T4CPreparedStatement.java:633)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1086)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2984)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3057)
at com.sunopsis.sql.SnpsQuery.executeUpdate(SnpsQuery.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execSrcOrders(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSqlS.treatTaskTrt(SnpSessTaskSqlS.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
at com.sunopsis.dwg.cmd.DwgCommandScenario.treatCommand(DwgCommandScenario.java)
at com.sunopsis.dwg.cmd.DwgCommandBase.execute(DwgCommandBase.java)
at com.sunopsis.dwg.cmd.e.i(e.java)
at com.sunopsis.dwg.cmd.g.y(g.java)
at com.sunopsis.dwg.cmd.e.run(e.java)
at java.lang.Thread.run(Thread.java:595)
ODI Procedure:
begin
select a.eno into #EMPNO from (select rownum r,e.* from trg_emp_01 e) a where a.r=#Counter;
end;
Exception:
6550 : 65000 : java.sql.SQLException: ORA-06550: line 1, column 26:
PL/SQL: ORA-00936: missing expression
ORA-06550: line 1, column 7:
PL/SQL: SQL Statement ignored
java.sql.SQLException: ORA-06550: line 1, column 26:
PL/SQL: ORA-00936: missing expression
ORA-06550: line 1, column 7:
PL/SQL: SQL Statement ignored
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:316)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:282)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:639)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:185)
at oracle.jdbc.driver.T4CPreparedStatement.execute_for_rows(T4CPreparedStatement.java:633)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1086)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2984)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3057)
at com.sunopsis.sql.SnpsQuery.executeUpdate(SnpsQuery.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execSrcOrders(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSqlS.treatTaskTrt(SnpSessTaskSqlS.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
at com.sunopsis.dwg.cmd.DwgCommandScenario.treatCommand(DwgCommandScenario.java)
at com.sunopsis.dwg.cmd.DwgCommandBase.execute(DwgCommandBase.java)
at com.sunopsis.dwg.cmd.e.i(e.java)
at com.sunopsis.dwg.cmd.g.y(g.java)
at com.sunopsis.dwg.cmd.e.run(e.java)
at java.lang.Thread.run(Thread.java:595)
Thanks
Phani
Edited by: Phanikanth on Jul 9, 2010 1:25 AM
Edited by: Phanikanth on Jul 9, 2010 2:08 AMGood point - In my case, these are single executable statements. These have been saved in ODI and executed successfully. Just no using my machine.
EXAMPLE 1------------
DECLARE
RetVal ;
I_STRING VARCHAR2(200);
BEGIN
I_STRING := '';
RetVal := XXX.PKG_XXX.SF_COMMA_TO_TABLE ( I_STRING );
COMMIT;
END;
EXAMPLE 2------------
SELECT C.COL1, B.COL2, B.COL3,TO_CHAR(B.EFFDT,'YYYY-MM-DD') COL4,B.COL5,B.COL6
FROM TABLE1 A, TABLE2 B, TABLE3 C
WHERE
and A.ID = 'XXX'
and a.setcntrlvalue = ' '
AND A.NAME = 'XXX'
AND A.EFFDT =
(SELECT MAX(A_ED.EFFDT) FROM TABLE1 A_ED
WHERE A.SETID = A_ED.SETID
AND A_ED.EFFDT <= SYSDATE)
AND B.EFFDT =
(SELECT MAX(B_ED.EFFDT) FROM TABLE2 B_ED
WHERE B.SETID = B_ED.SETID
AND B.ACCOUNT = B_ED.ACCOUNT
AND B_ED.EFFDT <= SYSDATE)
AND A.SETID = B.SETID
AND A.RANGE_FROM = A.RANGE_TO
AND B.ACCOUNT = A.RANGE_FROM
AND A.SETID = C.SETID
AND A.TREE_NAME = C.TREE_NAME
AND A.TREE_NODE_NUM = C.TREE_NODE_NUM
AND C.EFFDT =
(SELECT MAX(C_ED.EFFDT) FROM TABLE3 C_ED
WHERE C.SETID = C_ED.SETID
AND C_ED.EFFDT <= A.EFFDT)
------------------ -
Error while execution ODI procedure : java.lang.NullPointerException
Hi,
I`m trying to execute a simple ODI procedure and I`m getting the following exception:
java.lang.NullPointerException
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execCollOrders(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSqlS.treatTaskTrt(SnpSessTaskSqlS.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
at com.sunopsis.dwg.cmd.DwgCommandScenario.treatCommand(DwgCommandScenario.java)
at com.sunopsis.dwg.cmd.DwgCommandBase.execute(DwgCommandBase.java)
at com.sunopsis.dwg.cmd.e.j(e.java)
at com.sunopsis.dwg.cmd.g.F(g.java)
at com.sunopsis.dwg.dbobj.SnpScen.a(SnpScen.java)
at com.sunopsis.dwg.dbobj.SnpScen.localExecuteSync(SnpScen.java)
at com.sunopsis.dwg.tools.StartScen.actionExecute(StartScen.java)
at com.sunopsis.dwg.function.SnpsFunctionBaseRepositoryConnected.execute(SnpsFunctionBaseRepositoryConnected.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execIntegratedFunction(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSqlS.treatTaskTrt(SnpSessTaskSqlS.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
at com.sunopsis.dwg.cmd.DwgCommandScenario.treatCommand(DwgCommandScenario.java)
at com.sunopsis.dwg.cmd.DwgCommandBase.execute(DwgCommandBase.java)
at com.sunopsis.dwg.cmd.e.j(e.java)
at com.sunopsis.dwg.cmd.g.z(g.java)
at com.sunopsis.dwg.cmd.e.run(e.java)
at java.lang.Thread.run(Thread.java:595)
The source of the procedure:
select
P_ID,
P_NAME,
to_char(START_TIME_KEY,'DD-MON-YYYY HH24:MI:SS') as START_TIME_KEY,
to_char(END_TIME_KEY,'DD-MON-YYYY HH24:MI:SS') as END_TIME_KEY,
P_IS_ACTIVE,
from persons
The target of the procedure:
DECLARE
v_START_TIME_KEY DATE;
v_END_TIME_KEY DATE;
v_NAME VARCHAR2(200);
v_ID NUMBER;
BEGIN
v_NAME := '#P_NAME';
commit;
END;
ODI version: 10.1.3.5.5
Source and target technology: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
Thanks!Hello,
Is your aim to get the Name from the table into the variable. ?
And if there is only one row from the table you can use refresh variable to get the name:
if there are more rows and you want to do somehthing repeatedly using the name, then you need to use the method you have described.
Declare the variable in the pakcage and give some default value to the variable then call the procedure.
Regards
Reshma -
How to execute unix command from ODI Procedure
Hi,
I am trying to execute below unix command from ODI Procedure (Command on Target tab) but I am getting the error "java.io.IOException: Cannot run program "cd": error=2, No such file or directory" but when I try to execute the same command using OdiOSCommand, it is executing successfully. I don't want to use shell script to execute this command. Is there any specific syntax am I missing to execute this command from ODI procedure?
cd /project3/tmt/;ls *.dmp > dmplist.lst
Please help me on this...
Thanks
MTHi nahlikh,
Thank you for the reply.
I used below command in Procedure but still getting the same error as "java.io.IOException: Cannot run program "OdiOSCommand": error=2, No such file or directory".
OdiOSCommand "-COMMAND=cd /project3/tmt/;ls *.dmp > dmplist.lst"
as I mentioned earlier if I use the command cd /project3/tmt/;ls *.dmp > dmplist.lst in OdiOSCommand tool it is executing successfully without any issues.
any thoughts appreciated to get a solution for this issue.
Thanks
MT -
Update Statement in ODI Procedure
Hi All,
I want to update a value in a table through ODI procedure
I Created a procedure,added new step,given details like Technology,Context,Schema in Command on target
on the command:
i was trying with:-
update table_name
set column_name1='value1'
where column_name2='value2'
and also i tried with:-
begin
UPDATE Schema_name.Table_name SET column_name1='value1' WHERE column_name2='value2';
end;
in both cases i am unable to update the value in the table
Please suggest me
Thanks in AdvanceHi,
Thanks for the reply
I fixed that problem
It was caused due to Database error
Thanks -
Executing Java Code in ODI Procedure
Hi All,
I have following java code which i need to write on ODI procedure but i am not sure which technology to chose (Jython,Sunopsis API or Java BeanShell).
I tried to execute the procedure Jyhton with <% "Java code"%> but getting the error.Any boddy can suggest where i doing wrong.
<%
import javax.naming.Context;
import javax.naming.NamingEnumeration;
import javax.naming.directory.*;
import java.util.Hashtable;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
String userName = "HXXXXXX";
String CN1=null;
String Dis_Name=null;
String Mem_of=null;
String Mail=null;
String SGID=null;
File file = new File("C:/Project/ODI/LDAPID.txt");
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "LDAP://XX.if.YYYY.net:389/OU=XYZ,DC=ZZ,DC=if,DC=XYZ,DC=COM");
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, new String("" + "\\" + userName));
env.put(Context.SECURITY_CREDENTIALS, "");
DirContext ctx = null;
NamingEnumeration results = null;
ctx = new InitialDirContext(env);
SearchControls controls = new SearchControls();
controls.setSearchScope(SearchControls.SUBTREE_SCOPE);
results = ctx.search("", "(objectclass=person)", controls);
FileWriter fw = new FileWriter(file.getAbsoluteFile());
BufferedWriter bw = new BufferedWriter(fw);
while (results.hasMore())
SearchResult searchResult = (SearchResult) results.next();
Attributes attributes = searchResult.getAttributes();
Attribute attr = attributes.get("cn");
String cn = (String) attr.get();
CN1=(String.valueOf(attributes.get("cn")));
Dis_Name=(String.valueOf(attributes.get("displayName")));
SGID=(String.valueOf(attributes.get("userPrincipalName")));
Mem_of=(String.valueOf(attributes.get("memberOf")));
Mail=(String.valueOf(attributes.get("mail")));
bw.write(CN1 + " || " + Dis_Name + " || " + SGID + " || " + Mail);
bw.newLine();
bw.close();
results.close();
ctx.close();
%>
I am getting following error.
The application script threw an exception: java.lang.NullPointerException BSF info: CODE_JAVA at line: 0 column: columnNo
Please suggest what went wrong with the code.
Thanks
RegardsIn Jython you don not need to declare the type so String userName = "HXXXXXX"; should simply read userName = "HXXXXXX" . Lots of your code need to be rewritten to work with Jython if you choose that as your technology.
-
How to read I$ table using ODI procedure
Hi
Can any one help me how to drop a I$ table from out sie of interface.
I have tried below approches but no luck
I have created ODI procedure with technology oracle and target logical schema (I$ tables are creating on target DB) with and with out begin and end;
Approch 1:
Given below code in ODi procedure
drop table <%=odiRef.getTable("L", "INT_NAME", "W")%> <% if (new Integer(odiRef.getOption( "COMPATIBLE" )).intValue() >= 10 ) { out.print( "purge" ); }; %>
Approch 2:
drop table I$_<%=odiRef.getTable("L", "TARG_NAME", "A") %>;
Approch 3:
drop table <%=odiRef.getTable("L", "INT_NAME", "W")%> (but it is fetching target dtabase schema anme not I$ table)
Please help me any other alternative way to drop a I$ table, more over this code should be unique for all interface
Regards,
PhanikanthThanks bhabani,
Actaul my requirement is some time my scenario is stoping due some issue at Merge Rows Step (I am using IKM Oracle Incremental Update(Merge) KM) when the next iteration starts it is thwoing and error at create flow table I$ step and error is table name is already exists, so i am doing is if the interface went failed I am storing those information in one table using ODI procedure (INF--ko-->ODI procedure) in same ODI procedure I want to call a I$ table to drop.
Can you please provide the steps so it will very useful for me using Java variable.
I have gievn a step as below on create I$ table step (after create I$ statement)
<@ java.lang.String Idollertable = <%=odiRef.getTable("L", "INT_NAME", "W")%> ; @>
I am calling Idollertable variable in ODI procedure which is ko>* of INF as <@=Idollertable@>
Note: I have followed below approch
ODI Procedure Code:
drop table <@=Idollertable@>; --> *2nd approch*
begin
insert into ODI_EXECUTION_ERROR_DETAILS
(SESSION_NO,
SCENARIO_NAME,
CONTEXT_NAME,
ERR_MESSAGE,
INSERT_COUNT,
ERROR_COUNT)
values
<%=snpRef.getSession("SESS_NO")%>,
'<%=odiRef.getPrevStepLog("STEP_NAME")%>',
'<%=odiRef.getContext( "CTX_NAME" )%>',
'<%=odiRef.getPrevStepLog("MESSAGE")%>',
'<%=odiRef.getPrevStepLog("INSERT_COUNT")%>',
'<%=odiRef.getPrevStepLog("ERROR_COUNT")%>'
commit;
drop table <@=Idollertable@>; --> * first approch *
end;
Please help me
Regards,
Phanikanth
Edited by: Phanikanth on Mar 3, 2013 9:52 PM
Edited by: Phanikanth on Mar 3, 2013 9:52 PM -
Odi os call with option parameter from odi procedure
Hi.
I am calling a shell script from ODI as below inside an ODI procedure P1. The os command below is in 'Command on Target' side.I have defined v_in_param as an 'option' inside procedure P1
OdiOSCommand sample.sh v_in_param
i am getting error as 'OS command returned 1'.
Is it the right syntax to pass an 'option' parameter to an OS call?
thanksyou can try OdiOSCommand sh sample.sh <%=odiRef.getOption("v_in_param")%> or even call OS Command in ODI Package and paste the above code.
-
Importing ODI Procedure in Insert/Insert-Update mode
Can we import an ODI procedure from one project to another in INSERT or INSERT-UPDATE mode?
We are getting xml import error while doing this. But when we do the import in DUPLICATION mode, it successfully does so.
The issue is that we have an ODI procedure in INT environment which is been used by several other packages. We changed the code of it in our DEV environment and when we tried to import it in INT environment through INSERT-UPDATE mode so that the the changes gets effected, we got error.
This is quite obvious that the folder/sub-folder IDs are different in both environment and this is causing trouble.
So, is there any other way, we can reflect the change in the INT environment with minimum effort? I mean, we don't want to import it in DUPLICATION mode....if we do so, we will have to re-map that procedure in all the packages and regenerate them.You can use variable to replace the value at runtime in the query but you need to either pass the variable value at startup or you can refresh variable value. But I dont think you can directly retrieve any topology setting as the variable value to be substituted in the query.
-
ODI Procedure - updting the source table
Hi,
I need to call a PL/SQL package via ODI. I used ODI procedure to do the task.
In source tab - select empid from employee
In target tab -
decalre
ab varchar2(25);
begin
pack1.proced1(:empid,ab);
update success1 set val1 = ab where empid = *:empid;*
commit;
end;
But when i execute the procedure, its giving the error as missing parameter empid. It could not recognise the bolded part. When i give the direct value in the cmd,
update success1 set val1 = ab where empid = *101;* its working fine.
Any idea to resove this issue.
Thanks in Advance,
Ram Mohan TVijay,
1. Do you expect a single record to be returned by your source query?
No. My source query returns with multiple records.
2. What is the signature of your procedure? Does it accept a list of Id's or a single number.
My procedure accepts only one id at a time. After that is processed, the next id will be passed to the procedure.
Vijay, one thing i am confused is when I use a insert statement after the procedure its working fine (insert into success1 values(:empid,ab)).
When i use the update stmt without where condition after the procedure also working fine (update success1 set empid1 = :empid).
But when i use the where condition, update success1 set empid1 = ab where empid1=:empid its not working fine. Error is "Missing Parameter empid"
Thanks in Advance,
Ram Mohan T -
Passing parameters into ODI procedure step which has an OS command
Folks,
I have an ODI procedure step which does a directory listing for a specific directory. The command I am using is
cmd /C dir d:\local_dir /b > D:\dir_list.txt
I have put on the 'Command on Target' tab. This works fine
I want to remove the hardcoding for the directory references. I have tried the command
cmd /C dir '#src_dir' /b > D:\dir_list.txt
but when this executes it generates an ODI error 'Wrong process return code'
any suggestions?I've figured it out. The issue was with using quotes in the value being passed into the variable. Once removed, it worked fine. Thanks for the assistance.
Regards.
Edited by: user810644 on 17-May-2010 01:59 -
How to assign a value to ODI Variable using ODI Procedure
Hi ,
Is it possible to assign a value to a ODI Variable using ODI Procedure ?
If it is possible how we can do that.
BEGIN
IF #Counter=1
Then
#Next_Increment:=#Counter+1;
End if;
END;
In my example I have 2 ODI Variables #counter and #Next_increment.
I am trying to assign VALUE TO A ODI VARIABLE #next_increment from another ODI Variable #counter.
thanks
prasannaPrasanna,
I have a similar requirement where I need to assign values to ODI variables within a procedure. How do we make use of an ODI package to accomplish this ?
Actually, I have a sequence of ODI steps, and there is a call to a procedure 'LOG ERROR' from every step which gets called in case error occurs in any step. I just need to identify from which step the error came.
Please help. -
Call a Stored Procedure that returns a REFCURSOR using ODI Procedure
Hi,
I have a scenario wherein the stored procedure (TEST_PROC1) that returns a REFCURSOR. The second procedure(TEST_PROC2) will use the REFCURSOR as inpuut and insert it to a table.
Now, I need to execute the test procedures (TEST_PROC1 and TEST_PROC2) using the ODI Procedure but I always get error. However, I was able to execute the test procedures using sqlplus. Here is the command I used for sqlplus:
var rc refcursor
exec TEST_PROC1(:rc);
exec TEST_PROC2(:rc);
PL/SQL Stored Procedure:
-- TEST_PROC1 --
create or replace
PROCEDURE TEST_PROC1 (p_cursor IN OUT SYS_REFCURSOR)
AS
BEGIN
OPEN p_cursor FOR
SELECT *
FROM test_table1;
END;
-- TEST_PROC2 --
create or replace
procedure TEST_PROC2( rc in out sys_refcursor ) is
FETCH_LIMIT constant integer := 100;
type TFetchBuffer is table of test_table2%RowType;
buffer TFetchBuffer;
begin
loop
fetch rc bulk collect into buffer limit FETCH_LIMIT;
forall i in 1..buffer.Count
insert into test_table2(
c1, c2
) values(
buffer(i).c1, buffer(i).c2
exit when rc%NotFound;
end loop;
end;
Is there a way to call a PL/SQL Stored Procedure that returns a REFCURSOR using ODI Procedure?
Thanks,
CathyThanks for the reply actdi.
The procedure TEST_PROC1 is just a sample procedure. The requirement is that I need to call a stored procedure that returns a cursor using ODI and fetch the data and insert into a table, which in this case is test_table2.
I was able to execute a simple SQL procedure (without cursor) using ODI procedure. But when i try to execute the SQL procedure with cursor in ODI, I encountered error.
Do you have any idea how to do this? -
How to run dynamic SQL from an ODI procedure step
I am on ODI 11.1.1.6.4. From within an ODI IKM step I have no problem running a procedure step like the following which calls a pl/sql procedure to get SQL text then later runs that code. Is there anyway to do the same from within an ODI procedure? I've tried a couple of variations and can not seem to get the parsing levels to resolve within a procedure like they resolve from within a KM step.
<@
/* Setup Java variables */
String out_SQL = "";
try
java.sql.Connection sourceConnection = odiRef.getJDBCConnection("SRC");
String sqltxt = "{call set_sql(?)}";
java.sql.CallableStatement pstmt = sourceConnection.prepareCall(sqltxt);
try
pstmt.registerOutParameter( 1, java.sql.Types.VARCHAR);
pstmt.execute();
out_SQL = pstmt.getString(1);
catch(java.sql.SQLException ex)
errMessage = ex.getMessage();
errMessage = errMessage.replace("'","");
finally
pstmt.close();
catch(java.lang.Exception e)
errMessage = e.getMessage();
errMessage = errMessage.replace("'","");
@>
BEGIN
-- The SQL that I want to run
<@
out.println(out_SQL);
@>
-- Error handling
<@ if ( out_SQL.length() ==0 ) { @>
raise_application_error(-20101, '<@=errMessage@>');
<@ } else { @>
dbms_output.put_line('Successful.');
<@ } @>
END;
------Please understand that I know that I can do this all within PL/SQL -- I am explicitly doing it the way I have outlined because I want to better understand the parsing levels/behavior within ODI procedures and I want to understand why KMs steps behave differently.
Another observation -- putting this all within a pl/sql block prevents ODI from properly capturing insert/update/delete row counts like it would if it were running a SQL statement.
So the question remains -- is there a way to run a dynamic SQL statement in an ODI procedure where the SQL statement is generated from within an Oracle procedure call and then run as SQL within an ODI procedure step? Best would be if there is an example of how this can be done.
Maybe you are looking for
-
Bluetooth driver problem on windows 8.1 Yoga Tablet 2-1051f
Hi, I just purchased my yoga tablet 2 but i can't bluetooth get working. Bluetooth device has status "Windows has stopped this device because it has reported problems. (Code 43)". Currently installed driver from microsoft, version 6.3.9600.17093. Al
-
Hyperion web analysis java plugin
i have installed hyperion reporting and analysis 9.3 and hyperion reporting and analysis UI services 9.3 i need a java plugin before i run the URL [http://hostname:port/WebAnalysis_Server/index.html] please provide the java plugin Thanks.
-
Backing up multiple HDs onto Multiple HDs
I have 4 1TB hard drives that I am trying to backup onto 8 500GB hard drives. I have done this in the past manually, but its been a major headache, as I ususally have to split up folders across multiple drives to make it fit properly. Can anyone reco
-
My Home Page - "Today" will not load?
My Home Page - "Today" will not load? == This happened == Every time Firefox opened == over a week ago
-
B2B Correlation using replyToMessageID
Hi, I am trying to build a correlation using ebXML headers i.e. conversionID and RefToMessageID. I followed this blog and I managed to get some parts to work but am failing when trying to add a ReftoMessageID based on the format of the replyToMessage