Calling User Functions in ODI Procedure
Hi All,
Can anyone pass me the syntax in which i can call a ODI User Function in ODI Procedure?
Thanks,
Ritika
Hi,
just use
function("parameter_char", parameter_number)
Does it help you?
Cezar Santos
(www.odiexperts.com)
Similar Messages
-
Calling a Function inside a procedure
Can you call a function inside a procedure?...if so....how?
Not all built-in functions can be used directly in an assignment.
SQL> CREATE PROCEDURE p (p_val IN VARCHAR2) AS
2 l_v VARCHAR2(10);
3 BEGIN
4 l_v := DECODE(p_val,'YES','TRUE','FALSE');
5 END;
6 /
Warning: Procedure created with compilation errors.
SQL> show error
Errors for PROCEDURE P:
LINE/COL ERROR
4/4 PL/SQL: Statement ignored
4/11 PLS-00204: function or pseudo-column 'DECODE' may be used inside
a SQL statement onlyTTFN
John -
Calling user function from Interface mapping
I am getting error "Bad query:ORA-00904: invalid identifier" while calling function in the mapping of an interface.
Can some one provide the syntax of calling user function from interface mapping.
Thanks,
RPuser452108 wrote:
Can some one provide the syntax of calling user function from interface mapping.Oracle's Call Iinterface, the OCI, does not work differently when coding using a Dvorak keyboard, or writing code using a pretty pink font in the editor.. or coding the call from an interface mapping (whatever the hell that that is).
You have 2 types of calls. SQL and PL/SQL.
To call a function via SQL, it can be done using a the standard cursor interface. E.g.
select MyFunkyFunction from dualIt will return the function value via a single row with a single column. The standard cursor fetch and close cursor calls are used.
To call it via PL/SQL, an anonymous PL/SQL block is needed, and the caller needs to use a bind variable to receive the value from the function. The anon block will look as follows:
begin
:bindVar := MyFunkyFunction;
end;Refer to your client's abstract layer for interfacing with the Oracle Call Interface, on how to deal with bind variables. -
How can I call a function from a procedure
I have a function named: f_calc_value which return the variable v_result. This function is part of a package.
How can I call this function from a new procedure I am creating?
Thanksor refer this theread....calling function from procedure
-
I am new to ODI. I need to call a function created on the database which return a value. In ODI I created a variable. In the select (of the variable) I don't know how to call the source table value that needs to be passed to the function.
My oracle function:
create or replace function return_timeid(trans_date in date)
return number is
Result number;
v_trans_date varchar2(30) := to_char(trans_date, 'dd-mon-rrrr hh24miss');
v_hour number := 0;
v_min number := 0;
begin
v_hour := substr(v_trans_date, 13, 2);
v_min := substr(v_trans_date, 15, 2);
case
when v_min between 1 and 30 then
result := (v_hour * 100) + 30;
when v_min = 0 then
result := v_hour * 100;
when v_min > 30 then
result := (v_hour + 1) * 100;
end case;
-- convert 2400 to 0000
if result = 2400 then
result := 0;
elsif result = 2430 then
result := 30;
end if;
return result;
end return_timeid;
The result will be a time ID, depending on the source record value in the source table. How do I keep the time ID in the variable that I created.
This is the select in my variable (Time_ID):
SELECT BIUSER.return_timeid(GPRS_HOME_CDRS.CALL_DATE_DT) FROM dual
this is my error:
904 : 42000 : java.sql.SQLException: ORA-00904: "GPRS_HOME_CDRS"."CALL_DATE_DT": invalid identifier
RegardsI tried to call the function in the mapping. My code:
biuser.return_timeid(GPRS_HOME_CDRS.CALL_DATE_DT)
but then I get the ORA-00936 (missing expression)
My code generated in the operator when loading the flow table:
insert /*+ APPEND */ into BIUSER.I$_FACT_ABIL_GPRS_T
DIMDATASOURCEID,
DIMDATARECORDTYPEID,
DIMDATEID,
DIMTIMEID,
DIMAPNID_IC,
DIMIMSIID,
DIMCALLLOCATIONID,
DIMCAUSERECCLOSEID,
CALLDURATION,
UPLINK_DATAVOLUME,
DOWNLINK_DATAVOLUME,
CALL_CHARGE,
DIMRATEPLANID,
TRANS_DATE,
DIMPEAKID,
DIMTARIFFCODEID,
DIMCHARGEID,
MOBL_NUM,
ACC_LINK_CODE,
CHARGED_UNITS,
CHARGED_DURATION,
CHARGED_VOLUME,
DISCOUNTED_VALUE,
DISCOUNTED_AMOUNT,
FACT_PROCESS_DATE,
CHRONO_NUM,
ORIGINATE_CELL_ID,
STAGE_PROCESS_DATE,
IND_UPDATE
select
case
When length(rtrim(C19_QOS_USED_1_V)) = 7 then 1
else 2
end case,
DIM_DATA_RECORD_TYPE.DIMDATARECORDTYPEID,
DIM_DATE.DIMDATEID,
biuser.return_timeid(C12_CALL_DATE_DT), DIM_APN.DIMAPNID,
to_number(DIM_IMSI_MSISDN.DIMIMSIMSISDNID),
to_number(DIM_CALL_LOCATION.DIMCALLLOCATIONID),
to_number(DIM_TERM_CAUSE.DIMTERMCAUSEID),
C5_CALL_DURATION_N,
.DATA_VOLUME_OUTGOING_1_N,
C17_DATA_VOLUME_INCOMING_1_N,
C1_CALL_CHARGE,
DIM_RATEPLAN.DIMRATEPLANID,
C12_CALL_DATE_DT,
to_number(DIM_RATEPLAN.DIMRATEPLANID),
DIM_TARIFF.DIMTARIFFID,
to_number(DIM_CALLCHARGE_TYPE_TB.DIMCALLCHARGETYPEID),
C2_MOBL_NUM,
C21_ACCOUNT_LINK_CODE_N,
C10_CHARGED_UNITS_N,
C9_CHARGED_DURATION_N,
C8_CHARGED_VOLUME_N,
C16_DISCOUNTED_VALUE_N,
round(C15_DISCOUNTED_AMOUNT_N/1000,4),
SYSDATE,
C13_CHRONO_NUM_N,
C6_ORGINATE_CELL_ID_V,
C3_STAGE_PROCESS_DATE,
'I' IND_UPDATE
from BIUSER.DIM_DATA_RECORD_TYPE DIM_DATA_RECORD_TYPE, BIUSER.DIM_DATE DIM_DATE, BIUSER.DIM_CALL_LOCATION DIM_CALL_LOCATION, BIUSER.DIM_APN DIM_APN, BIUSER.DIM_IMSI_MSISDN DIM_IMSI_MSISDN, BIUSER.DIM_TERM_CAUSE DIM_TERM_CAUSE, BIUSER.DIM_CALLCHARGE_TYPE_TB DIM_CALLCHARGE_TYPE_TB, BIUSER.DIM_TARIFF DIM_TARIFF, BIUSER.DIM_RATEPLAN DIM_RATEPLAN, BIUSER.C$_0FACT_ABIL_GPRS_T
where (1=1)
And (nvl(to_number(C14_SWITCH_CALL_TYPE_V),99999)=DIM_DATA_RECORD_TYPE.RECORD_TYPE)
AND (to_number(to_char(C12_CALL_DATE_DT,'RRRRMMDD'))=DIM_DATE.DIMDATEID)
AND (nvl(C11_MOBL_ORIGINATE_ZONE_CODE_V,'Undefined')=DIM_CALL_LOCATION.COUNTRY)
AND (nvl(C4_ACCESS_POINT_NAME_V,'Undefined')=DIM_APN.APN)
AND (nvl(C23_IMSI_NUM_N,99999999999)=DIM_IMSI_MSISDN.IMSI_NR)
AND (nvl(C20_CALL_TERMINATION_CAUSE_V,'XX')=DIM_TERM_CAUSE.TERMCAUSE)
AND (nvl(C18_CALL_CHRG_TYPE_V,'9')=DIM_CALLCHARGE_TYPE_TB.CALL_CHARGE_TYPE)
AND (nvl(C7_TARIFF_CODE_V,'999999')=DIM_TARIFF.TARIFF_CODE)
AND (nvl(C22_RATE_PLAN_CODE_N,99999)=DIM_RATEPLAN.RATEPLAN_CODE and
nvl(C7_TARIFF_CODE_V,'999999')=DIM_RATEPLAN.TARIFF_CODE)
minus
select
DIMDATASOURCEID,
DIMDATARECORDTYPEID,
DIMDATEID,
DIMTIMEID,
DIMAPNID_IC,
DIMIMSIID,
DIMCALLLOCATIONID,
DIMCAUSERECCLOSEID,
CALLDURATION,
UPLINK_DATAVOLUME,
DOWNLINK_DATAVOLUME,
CALL_CHARGE,
DIMRATEPLANID,
TRANS_DATE,
DIMPEAKID,
DIMTARIFFCODEID,
DIMCHARGEID,
MOBL_NUM,
ACC_LINK_CODE,
CHARGED_UNITS,
CHARGED_DURATION,
CHARGED_VOLUME,
DISCOUNTED_VALUE,
DISCOUNTED_AMOUNT,
FACT_PROCESS_DATE,
CHRONO_NUM,
ORIGINATE_CELL_ID,
STAGE_PROCESS_DATE,
'I' IND_UPDATE
from BIUSER.FACT_ABIL_GPRS_T -
Call Oracle function from Stored Procedure
Hi,
I have function Which returning one number. I want to use that number in a procedure. How to call the Oracle Function from the Procedure
Create procedure
AS
Begin
Check number;
Select Function1 into check from dual;
It is giving error.
Can anyone provide me example for this.
Thanks in advancePut the Check Number; before begin
SQL> create or replace procedure abc as
2 begin
3 val number;
4 select abcd into val from dual;
5 dbms_output.put_line(val);
6 end;
7 /
Warning: Procedure created with compilation errors.
Elapsed: 00:00:00.00
SQL> show error
Errors for PROCEDURE ABC:
LINE/COL ERROR
3/5 PLS-00103: Encountered the symbol "NUMBER" when expecting one of
the following:
:= . ( @ % ;
The symbol ":=" was substituted for "NUMBER" to continue.
SQL> create or replace procedure abc as
2 val number;
3 begin
4 select abcd into val from dual;
5 dbms_output.put_line(val);
6 end;
7 /
Procedure created.
Elapsed: 00:00:00.00
SQL> exec abc;
100.22
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.00
SQL> -
How can i call my function from a procedure?
My function is:
create or replace FUNCTION test(pAttributeName IN NUMBER)
RETURN VARCHAR2 IS
ret VARCHAR2(100) := NULL;
VAR n1 NUMBER
BEGIN
SELECT Klartext INTO ret FROM piclist WHERE ATTRIBUTNAME = 'voltage_level' and PICLIST_ID =pAttributeName;
RETURN ret;
Insert into BM_ATTRIB(ID_ERFASSUNG,ID_ATTRIBNAME,ATTRIB_CHA,BM_ATTRIB_ID) VALUES(1,1,ret,1);
exception
when no_data_found then
ret := 'AAA' ------- you can return any default value,if you like
--return ret;
return NULL;
when others then
dbms_output.put_line('Exception:'||sqlerrm);
End;
I want to call it from a procedure!
Please help!
Nicoleif the function is in the same package as the procedure then merely specify the function name and parameters:
retcode := functionname(param1..paramn);
If in another package then:
retcode := packagename.functionname(param1..paramn);
If the function is in another schema then you need to grant execute rights to the package/function to the schema trying to run the function:
grant execute on packagename/functionname to otherschema;
you need to be the package/function schema owner to do the above grant. -
Calling user function in where clause
Hi
I need to use a sql query in following format.
SELECT * from emp
where emp_name = getEmpName (p_emp_id => '123');
getEmpName is a private function within the package which will return a emp_name for a given emp_id.
But it is giving error that missing right parenthesis.
Please any one help.Hi
I need to use a sql query in following format.
SELECT * from emp
where emp_name = getEmpName (p_emp_id => '123');
getEmpName is a private function within the package
which will return a emp_name for a given emp_id.
But it is giving error that missing right
parenthesis.
Please any one help.Try to use like this
SELECT * from emp
where emp_name = getEmpName (p_emp_id >= '123'); -
Calling function in to procedure
how can i call a function in a procedure?
i m calculating average in function and i want to display that avg in dbms output of
procedure.how can i do that?u want to claculate the avg value for entire records
create a function with in parameter.
and call that function in procedure.in this case u have to use cursor
and call that function in loop.
regards -
How to call WSDL in ODI procedure
Hi experts,
Please help me on "how to call web service in ODI procedure"
Thanks in advance
Regards
PhaniHi,
use the OdiInvokeWebService command... take a look into the manual for options reference...
Does it help you?
Cezar Santos
http://odiexperts.com -
Converting Oracle Functions to ODI
Does anyone have an example of converting an Oracle function to ODI?
FUNCTION <function_name> (
<parameters> [IN | OUT | IN OUT] [NOCOPY] <data_type>)
RETURN <data_type> [AUTHID <CURRENT_USER | DEFINER>] IS
<constant, exception, and variable declarations>
BEGIN
<code_here>;
END <function_name>;
Can you call a Function in ODI?Yes you can call a PL/SQL or oracle funciton from ODI.
FOr that you will have to create a ODI procedure with technology as Oracle.
Call that function in to a PL/SQL "BEGIN END" block.
Value returned by function you can use there is self or can pass to an ODI variable.
Hope it helps!
Regards,
amit -
How to call user fuction in select statement.
hi,
i am facing some problem.How to call user functions in select statement.please send me answer with example.
Thanks
GopalLocations to Call User-Defined Functions
• Select list of a SELECT command
• Condition of the WHERE and HAVING clauses
• CONNECT BY, START WITH, ORDER BY, and GROUP
BY clauses
• VALUES clause of the INSERT command
• SET clause of the UPDATE command
Restrictions on Calling Functions from SQL Expressions
To be callable from SQL expressions, a user-defined
function must:
• Be a stored function
• Accept only IN parameters
• Accept only valid SQL data types, not PL/SQL
specific types, as parameters
• Return data types that are valid SQL data types,
not PL/SQL specific types
• Functions called from SQL expressions cannot
contain DML statements.
• Functions called from UPDATE/DELETE statements
on a table T cannot contain DML on the same table
T.
• Functions called from an UPDATE or a DELETE
statement on a table T cannot query the same table.
• Functions called from SQL statements cannot
contain statements that end the transactions.
• Calls to subprograms that break the previous
restriction are not allowed in the function.
jeneesh -
Problem while using a user function
Hi,
I just want to learn how a user function in ODI works.
I have created a user function(for Oracle technology).
In Definition Tab, I gave bfun($(branchc))
In implementation I gave
if ($(branchc) = 'it' || 'cse') then
return('IT')
else
return('Non-IT')
end if
In a mapping rule i am using it as BFUN(STUDENT.BRANCH)
I am getting the following error...
Bad Query: ORA-00904: "BFUN": Invalid Identifier
select BFUN('STUDENT.BRANCH') from EX.STUDENT STUDENT where (1=2).
EX is my source schema.
Please help me in resolving this.Hi,
That is a common error on ODI.
The ODI function, (as ODI variable) is to "substitute words", it means, ODI is a code generator and a function are made to substitute code, not to "execute" that action coded.
For instance: If there are a "case when" instruction that is necessary be typed over and over again, at several places just change the column to be evaluate, you can create a ODI function to substitute this code avoiding type it several times and better, let the same code in just one place.
Is a way to have “Object Orientation” coding (OO) to code generation...
Does it make any sense to you?
Cezar Santos -
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 -
Calling PL/SQL user defined functions from ODI Constraints
Hi All,
We are trying to call user defined PL/SQL functions from ODI. We are able to call them from ODI's User functions. But when we are trying to call them from ODI Constraints under Models, it is throwing an error 'ORA-00920 invalid relational operator'. Kindly let me know if anyone has faced the same issue and got the resolution for the same. Thanks in Advance.
Regards,
Abhishek SharmaHi Ace,
Thanks for the response, the same error was coming in operator also.
I am able to call PL?SQL user defined functions from ODI Constraints. We have to first call ODI User functions from the ODI constraints as we cant call PL/SQL function (compiled in database) directly.
From the ODI User functions, we can then call the PL/SQL functions.
Please reach out to me if you need further details reg this.
Maybe you are looking for
-
When I open the application the following alert appears: "Could not initialize the application's security component. The most likely cause is problems with files in your application's profile directory." There is a solution on the support site but on
-
Why does my iPod Touch 5th Gen not go back to sleep after a notification?
No matter what notification it is, my iPod will stay with the screen lit for forever, just resting on the lock screen. I have to physically hit the sleep button to put it back into sleep. I have the auto-lock set for two minutes, and it's now beginni
-
Hi Automatic Payment Program considers due date for making payment to vendors. Now i want to know if there is possible for making payment on the basis of average due date (calculated on the basis of amount and the actual due date). Requirement: While
-
How to stop gpupdate /force from asking press Y / N to restart computer in cmd?
Each time after gpupdate /force finish to refresh the policy in cmd it popup a message press Y / N to restart computer after pressed Y it popup a dialogbox press O.K to restart PC. How to prevent gpudate /force from asking press Y / N and then dialog
-
Hi! Can't figure that one out, as I don't know what to search for: How do I get english output / build logs from makepkg ? Is there a config file for that, do I have to temporarily change the locale (how?) of a terminal or what? Last edited by whoop