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 Sharma

Hi 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.

Similar Messages

  • How to call Microsoft SQL User defined function??

    I am trying to call Miscrosoft SQL user defined function (not stored procedure) and experience problems. The function -- func_profile_history takes 3 inputs and returns resultSet.
    Please let me know if there is any examples some where. All the examples I found are for stored procedure.
    Thanks....
    Siu
    ************ source *************
    public Vector callSqlFunction(String eidTradcom, String idSku, String endDate, String idUserPost)
    throws TradcomException, RemoteException
    System.out.println("--------------in callSqlFunction--------------1");
    Connection conn = null;
    java.sql.CallableStatement cstmt = null;
    ResultSet rs = null;
    ForecastInfo info = null;
    Vector v = new Vector();
    try{
    conn = TradcomUtils.getConnection();
    String sql = "{call func_profile_history(?,?,?)}";
    System.out.println("--------------in callSqlFunction--------sql="+sql);          
    cstmt = conn.prepareCall(sql);
    System.out.println("--------------in callSqlFunction-------2");                         
    cstmt.setString(1, eidTradcom);
    cstmt.setString(2, idSku);
    cstmt.setString(3, endDate);
    System.out.println("--------------in callSqlFunction-------3");                    
    rs = cstmt.executeQuery();
    System.out.println("--------------in callSqlFunction-------4");                    
    while (rs.next()){
         info = new ForecastInfo ();
         info.setEidTradcom(rs.getString("eid_tradcom"));
         info.setIdSku(rs.getString("id_sku"));                    
         info.setQtOnHand(rs.getDouble("qt_on_hand"));                    
         info.setQtOnHold(rs.getDouble("qt_hold"));
         info.setQtNetOnHand(rs.getDouble("qt_net_on_hand"));
         info.setQtAlloc(rs.getDouble("qt_alloc"));
         info.setQtAvailUnalloc(rs.getDouble("qt_avail_unalloc"));     
         info.setQtPoShip(rs.getDouble("qt_po_ship"));
         info.setQtPoRcvd(rs.getDouble("qt_po_rcvd"));
         info.setQtTransit(rs.getDouble("qt_transit"));
         info.setQtAsn(rs.getDouble("qt_asn"));                    
         info.setQtPo(rs.getDouble("qt_po"));
         info.setQtPoBalance(rs.getDouble("qt_po_balance"));
         info.setQtSoShip(rs.getDouble("qt_so_ship"));     
         info.setQt4Cast(rs.getDouble("qt_4cast"));
         v.addElement(info);
    System.out.println("--------------in callSqlFunction-------5");     
    System.out.println("--------------in callSqlFunction-------v="+v);          
    return v;
    }catch(Exception ex){
    System.out.println("Error in callSqlFunction:"+ ex.getMessage());
    throw CachingManager.getTradcomException(ex, "Error in callSqlFunction");
    }finally{
    try{ if (cstmt != null) cstmt.close(); } catch(Exception ex){}
    try{ if (conn != null) conn.close(); } catch(Exception ex){}
    ********************* error output ***************
    ********************* bef calling callSqlFunction
    --------------in callSqlFunction--------------1
    --------------in callSqlFunction--------sql={call func_profile_history(?,?,?)}
    --------------in callSqlFunction-------2
    --------------in callSqlFunction-------3
    Error in callSqlFunction:The request for procedure 'func_profile_history' failed
    because 'func_profile_history' is a function object. Severity 18, State 1, Proc
    edure 'LAP_DUAL null', Line 4
    ERROR=Error in callSqlFunction...The request for procedure 'func_profile_history
    ' failed because 'func_profile_history' is a function object. Severity 18, State
    1, Procedure 'LAP_DUAL null', Line 4

    well, I tried the preparedStatemnet and it worked. Case closed.

  • SQL User Defined Functions for performing statistical calculations

    Hi!
       I hope you can help.  I just wasn’t sure where to go with this question, so I’m hoping you can at least point me in the right direction.
       I’m writing a SQL Server stored procedure that returns information for a facility-wide scorecard-type report.  The row and columns are going to be displayed in a SQL Server Reporting Services report. 
       Each row of information contains “Current Month” and “Previous Month” numbers and a variance column.  Some rows may compare percentages, others whole numbers, others ratios, depending on the metric they’re measuring.  For each row/metric the company has specified whether they want to see a t-test or a chi-squared statistical test to determine whether or not there was a statistically significant difference between the current month and the previous month. 
       My question is this:  Do you know where I can find a set of already-written user defined functions to perform statistical calculations beyond the basic ones provided in SQL Server 2005?  I’m not using Analysis Services, so what I’m looking for are real SQL User Defined Functions where I can just pass my data to the function and have it return the result within a stored procedure. 
       I’m aware that there may be some third-party statistical packages out there we could purchase, but that’s not what I’m looking for.   And I’m not able to do anything like call Excel’s analysis pack functions from within my stored procedure.   I’ve asked.   They won’t let me do that.   I just need to perform the calculation within the stored procedure and return the result.
       Any suggestions?  Is there a site where people are posting their SQL Server UDF’s to perform statistical functions?  Or are you perhaps aware of something like a free add-in for SQL that will add statistical functions to those available in SQL?   I just don’t want to have to write my own t-test function or my own chi-squared function if someone has already done it.
     Thanks for your help in advance!  Oh, and please let me know if this should have been posted in the TSQL forum instead.  I wasn't entirely sure.
    Karen Grube

    STATS_T_TEST_
    docs.oracle.com/cd/B19306_01/server.102/b14200/functions157.htm 
    STATS_T_TEST_ONE: A one-sample t-test
    STATS_T_TEST_PAIRED: A two-sample, paired t-test (also known as a crossed t-test)
    STATS_T_TEST_INDEP: A t-test of two independent groups with the same variance (pooled variances)
    STATS_T_TEST_INDEPU: A t-test of two independent groups with unequal variance (unpooled variances)

  • Using a SQL user-defined function in Crystal Reports XI

    Post Author: JoannKarp
    CA Forum: Formula
    Is it possible to use a user defined function in SQL and use this in multiple Crystal reports?
    JoannKarp

    SELECT COALESCE(ufn_GetAddressByBusinessEntityIDandAddressTypeID(table1.BusinessEntityID,712),ufn_GetAddressByBusinessEntityIDandAddressTypeID(table1.BusinessEntityID,712)) AS Zipcode
      FROM table1
    Nope. This is two function calls. coalesce(a, b, c, ...) is just syntatic sugar for
       CASE WHEN a IS NOT NULL THEN a
            WHEN b IS NOT NULL THEN b
            WHEN c IS NOT NULL THEN c
       END
    But if you use isnull it's a different matter. (But isnull() permits two arguments.)
    Erland Sommarskog, SQL Server MVP, [email protected]

  • ? Regarding 'SQL user-defined function' execution performance ?

    Hi All,
    I have an user-defined function in SQL which am using in a SQL select statement and i found that the execution time taken by the user-defined function is 9-10 minutes as a result of which my whole query execution time is affected.
    How to i improvise the execution time. Should i do some sort of scheduling for executing the user-defined functions only. Am new to the database world. Your early response with a good suggestion would really be appreciated.
    Thanks in Advance.

    Try to read SQL tuning documents along with TkProf. Then only you will be able to detect the problem.
    There is no instant method by which you can solve this problem.
    But, you can get idea from this samples.
    Tuning:
    http://www.dba-oracle.com/art_sql_tune.htm
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::NO::P11_QUESTION_ID:8764517459743
    Reading TkProf:
    http://www.dbspecialists.com/presentations/use_explain.html
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:920429344869
    Regards.
    Satyaki De.

  • Using a User Defined Function as a constraint within a temporary table.

    Hello, 
    I am trying to create a temp table that uses a UDF in a constraint. I'm getting the following error message 
    Msg 4121, Level 16, State 1, Line 1
    Cannot find either column "dbo" or the user-defined function or aggregate "dbo.CK_LoseTeamSportExists", or the name is ambiguous.
    I've tested the function and it works in other contexts. Any idea? All code below:  
    Thanks, 
    - Bryon
    create function dbo.CK_LoseTeamSportExists (@loseteam int, @sportid int)
    returns bit
    as
    begin
    declare @return bit
    if exists 
    select TeamID, sportid from Link_TeamSport
    where 
    TeamID = @loseteam 
    and
    SportID = @sportid
    set @return = 1
    else set @return = 0
    return @return
    end
    go
    create table #check
    SportID int
    ,WinTeamID int
    ,LoseTeamID int
    ,check 
    (dbo.CK_LoseTeamSportExists(LoseTeamID,SportID) = 1)

    Please post DDL, so that people do not have to guess what the keys, constraints, Declarative Referential Integrity, data types, etc. in your schema are. Learn how to follow ISO-11179 data element naming conventions and formatting rules. Temporal data should
    use ISO-8601 formats. Code should be in Standard SQL as much as possible and not local dialect. 
    This is minimal polite behavior on SQL forums. 
    >> I am trying to create a temp table that uses a UDF in a constraint. <<
    You do not understand how SQL or any declarative language works! 
    We do not use UDFs (procedural programming)
    We do not use bit flags (assembly language).
    We do not use temp tables (mag tape files).
    We do not use integer as identifiers (what math do you do on them?)
    Your silly “Link_TeamSport” implies a pointer chain; we have no links in SQL. Where is the DDL? 
    Constraints are always predicates in any declarative language. 
    Do you know why you have to create a local variable to pass the non-relational flag back to the calling environment? FORTRAN I and II! These early languages has to use hardware registers in the first IBM computers to return results. In your ignorance, you mimic
    them! 
    We do not use if-then-else control flow in any declarative language. We have CASE expressions that we put where you have a local variable getting an assignment. 
    I see you also put the comma at the start of the line. We did that with punch cards, so we could re-use them 50 years ago. 
    In SQL, we would use REFERENCES to assure a team reference exists. We use names for teams because they are entities, not quantities: 
    CREATE TABLE Game_Results
    (sport_name CHAR(10) NOT NULL PRIMARY KEY,
     win_team_name CHAR(12) NOT NULL
      REFERENCES Teams(team_name)
       ON DELETE CASCADE,
     lose_team_name CHAR(12) NOT NULL
      REFERENCES Teams(team_name)
       ON DELETE CASCADE,
     CHECK (win_team_name <> lose_team_name)); 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • How to distinguish the User-Defined-Function from Oracle Build-In function

    Hi Friends,
    I could get the function list form all_objects table by the SQL:
    select * from all_objects where object_type = 'FUNCTION'
    but there is no column in all_objects specify the function is build-in or user-defined.
    But I found in SQL Server there is a column "is_ms_shipped" in the sys.all_objects table. This column will specify the object is build-in or user-defined. I want to get the equivalent column in Oracle but failed.
    Could anyone tell me how to solve this problem?
    Thanks,
    Ricky

    Thanks Pavan.
    But if an user connects to database using "conn /as sysdba" syntax and creates a function. This user-defined funtion goes into the "SYS" schema also. I know it is not the best practise to create objects using sys user so I think your solution is right.
    Regards,
    Ricky

  • Calling a User defined function from Data Model in BIP

    I am new to Procedures and Functions and am not sure if I am doing it right, so please bear with me.
    My User Function:
    create function MyTempFunction(@master_key varchar(max))
    returns VARCHAR(MAX)
    begin
    DECLARE @Names VARCHAR(8000)
    SELECT @Names = COALESCE(@Names + ', ', '') + vndt.name
    from
    [CMPROJ].[dbo].[VNDT] as vndt,
    [CMPROJ].[dbo].[CRQT_QUESTION_DISTRIBUTION] as CQD
    where CQD.parent_key=@master_key
    and CQD.project_name=vndt.project_name
    and vndt.initials=CQD.distributed_to_ini
    return @Names
    endIf I call the function in my query window I get a result:
    "Ron Swanson, Anne Perkins"
    But if I put the same query into my Data Model in BI Publisher and try getting the XML Output, my data is blank.
    This is how I call the function:
    select top 1 dbo.MyTempFunction('98d4dfa893164d138d5f961fa4') as Names from dbo.[CRQT_QUESTION_DISTRIBUTION]And I know that BIP did access the function, because the first time I tried to save the new SQL Query, it threw an error saying it was denied access to the function and I had to add the user to be able to execute the function.
    I am new to doing Procedures and Functions, so I am not sure if I am even doing it right.
    And don't know if even calling procedures or functions works form BIP.
    Any help appreciated.
    Thanks

    Thanks for the suggestion, but I still get nothing in the XML result set.
    I enabled some extra logging in the bipublisher.log file and I get an error:
    [2012-12-21T08:14:37.658-06:00] [AdminServer] [TRACE] [] [oracle.xdo] [tid: 11] [userId: <anonymous>] [ecid: e661403a668a80f1:56f304f5:13baf5ed125:-8000-0000000000003097,0] [SRC_CLASS: oracle.xdo.dataengine.XMLPGEN] [APP: bipublisher#11.1.1] [SRC_METHOD: processSQLDataSource] Sql Query :Distrubuted_To: select dbo.MyTempFunction('98d4dfa893164d138d5f961fa4') as Names [[
    from dbo.[CRQT_QUESTION_DISTRIBUTION]
    [2012-12-21T08:14:37.658-06:00] [AdminServer] [WARNING] [] [oracle.xdo] [tid: 11] [userId: <anonymous>] [ecid: e661403a668a80f1:56f304f5:13baf5ed125:-8000-0000000000003097,0] [APP: bipublisher#11.1.1] java.io.IOException: [Hyperion][SQLServer JDBC Driver]Object has been closed.[[
         at hyperion.jdbc.sqlserverbase.BaseCharacterStreamWrapper.validateClosedState(Unknown Source)
         at hyperion.jdbc.sqlserverbase.BaseCharacterStreamWrapper.read(Unknown Source)
         at oracle.xdo.dataengine.LOBList.readLobChunks(LOBList.java:263)
         at oracle.xdo.dataengine.XMLPGEN.writeLobToStream(XMLPGEN.java:976)
         at oracle.xdo.dataengine.XMLPGEN.writeRowSetListToStream(XMLPGEN.java:948)
         at oracle.xdo.dataengine.XMLPGEN.processSQLDataSource(XMLPGEN.java:479)
         at oracle.xdo.dataengine.XMLPGEN.writeData(XMLPGEN.java:345)
         at oracle.xdo.dataengine.XMLPGEN.writeGroupStructure(XMLPGEN.java:286)
         at oracle.xdo.dataengine.XMLPGEN.writeXMLDataStructure(XMLPGEN.java:216)
         at oracle.xdo.dataengine.XMLPGEN.processDataSet(XMLPGEN.java:1450)
         at oracle.xdo.dataengine.XMLPGEN.processMergedDataSet(XMLPGEN.java:1258)
         at oracle.xdo.dataengine.DataProcessor.processData(DataProcessor.java:366)
         at oracle.xdo.servlet.dataengine.DataProcessor.processData(DataProcessor.java:402)
         at oracle.xdo.servlet.dataengine.DataProcessor.processData(DataProcessor.java:389)
         at oracle.xdo.online.data.ClassicDataProcessor.process(ClassicDataProcessor.java:157)
         at oracle.xdo.servlet.ReportModelContextImpl.getReportXMLData(ReportModelContextImpl.java:232)
         at oracle.xdo.servlet.CoreProcessor.process(CoreProcessor.java:310)
         at oracle.xdo.servlet.CoreProcessor.generateDocument(CoreProcessor.java:93)
         at oracle.xdo.servlet.ReportImpl.renderBodyHTTP(ReportImpl.java:1059)
         at oracle.xdo.servlet.ReportImpl.renderReportBodyHTTP(ReportImpl.java:624)
         at oracle.xdo.servlet.XDOServlet.writeReport(XDOServlet.java:473)
         at oracle.xdo.servlet.XDOServlet.writeReport(XDOServlet.java:445)
         at oracle.xdo.servlet.XDOServlet.doGet(XDOServlet.java:265)
         at oracle.xdo.servlet.XDOServlet.doPost(XDOServlet.java:297)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:821)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
         at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:27)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:57)
         at oracle.xdo.servlet.metadata.track.MostRecentFilter.doFilter(MostRecentFilter.java:65)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:57)
         at oracle.xdo.servlet.security.SecurityFilter.doFilter(SecurityFilter.java:122)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:57)
         at oracle.xdo.servlet.init.InitCheckingFilter.doFilter(InitCheckingFilter.java:64)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:57)
         at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:111)
         at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
         at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)
         at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94)
         at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:161)
         at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:57)
         at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:136)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:57)
         at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:111)
         at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
         at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)
         at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94)
         at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:161)
         at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
    ]]This same error gets displayed 5 times in a row with the new changes to the query.
    And If I look in the XML result set that I get when I do a test run I get:
    <G_7>
         <NAMES></NAMES>
    </G_7>
    <G_7>
         <NAMES></NAMES>
    </G_7>
    <G_7>
         <NAMES></NAMES>
    </G_7>
    <G_7>
         <NAMES></NAMES>
    </G_7>
    <G_7>
         <NAMES></NAMES>
    </G_7>So you can see that I am getting a blank value 5 times.
    When I run it with the "top 1" I only get the error once and I only see 1 entry in the XML.
    Thanks,

  • Accessing a Cache From an Oracle CQL User-Defined Function

    According to the docs ...
    I am to use the following element to set the cache property in my bean...
    <wlevs:property name="cache" ref="cache-id"/>
    However, when I set it, the assembly does not validate.
    If I use <property>, I get a NullPointerException on each request when my processor runs.
    Using the same CQL code..
    Without the <property> tag, the call to the user-defined function works (but I don't have the cache attribute set obviously).
    Here is the excerpt from my assembly...
    <bean id="cacheFunction" class="ou.cep.function.CacheFunction">
    <property name="cache" ref="myCache"/>
    </bean>
    <!-- The default processor for OCEP 11.0.0.0 is CQL -->
    <wlevs:processor id="myProcessor">
    <wlevs:listener ref="CacheChannel"/>
    <wlevs:function ref="cacheFunction" function-name="isValidID" exec-method="isValidID">
    </wlevs:function>
    </wlevs:processor>
    To repeat, with the same CQL with the user-defined function call, if I remove the property element from the bean definition, I can call the function successfully (it just doesn't do what I need it to do). In this case, I am still using the ref=cacheFunction for the wlevs:function within the processor.
    What am I doing wrong?
    Edited by: fl0at on Oct 5, 2010 12:22 PM
    Edited by: fl0at on Oct 5, 2010 12:28 PM

    The case is solved, not sure I could explain why, but...
    This implementation of the user-defined function was a migration from an implementation using the same cache in the join. So, when I removed the cache reference in the source stream (where I am now executing a function that accesses the cache), the problem went away and everything is working.
    I can explain further if there are questions.
    If anyone has thoughts on this, please advise.
    As always, thanks for the help.

  • 10g - cache, report contains oracle user defined function

    hi, experts,
    from http://obiee101.blogspot.com/2008/07/obiee-cache-management.html
    Reasons Why a Query is Not Added to the Cache:
    •Non-cacheable SQL element. If a SQL request contains Current_Timestamp, Current_Time, Rand, Populate, or a parameter marker then it is not added to the cache.
    •Non-cacheable table. Physical tables in the Oracle BI Server repository can be marked 'noncacheable'. If a query references any non-cacheable table then the query results will not be added to the cache.
    •Cache hit. In general, if the query gets a cache hit on a previously cached query, then the results of the current query are not added to the cache. The exception is query hits that are aggregate roll-up hits.
    •Result set is too big.
    Query is cancelled. This can happen by explicit cancellation from Oracle BI Presentation Services or the Administration Tool, or implicitly through timeout.
    •Oracle BI Server is clustered. Queries that fall into the ‘cache seeding’ family are propagated throughout the cluster. Other queries continue to be stored locally. Therefore, even though a query may be put into the cache on Oracle BI Server node 1, it may not be on Oracle BI Server node 2.
    I would like to know
    if the request (report on dashboard) calls an oracle user defined function,  can the cache be created and saved for this report?
    thank you very much!

    Hi stephen,
    if the request (report on dashboard) calls an oracle user defined function, can the cache be created and saved for this report?Yes,it is cached.....function defined in database is called in OBIEE is cached and saved.
    More information and example can be found here http://oraclebizint.wordpress.com/2007/09/10/oracle-bi-ee-10133-support-for-native-database-functions-and-aggregates/
    Hope it helps you.Check all other questions you posted are answered?
    By,
    KK

  • USER DEFINED FUNCTIONS IN FORM 6i

    I am interested to learn how can I manipulate, call a database user define function in a form6i that I am now using. It should give me desire database information on the forms? I am sorry, if I could explain the topics?
    Thanks & regards
    Dharani Barman

    Just call the function from PL/SQl or SQL in your Forms code - it shoudl all work providing that the user you are connected as has access to and execution rights on that function, and that the function uses parameters and return types that are compatible with the version of PL/SQL that the Forms engine has.

  • How to use pl/sql code as ODI user defined function

    Hi All,
    i have a pl/sql code and i want to create ODI user defined function using this code .
    please find the pl/sql code below:
    ============================
    declare
    v_no_of_duplicate_rec number := 0;
    begin
    select count(*)
    into v_no_of_duplicate_rec
    from ( select 1
    from temp_pre_selections
    group by svb_number, selection_id
    having count(*) > 1);
    if v_no_of_duplicate_rec = 0 then
    return 'N';
    else
    return 'Y';
    end if;
    end if;
    ==========================
    please help me how to achieve the same .
    Thanks
    Vinod

    2 ways:
    a. implement logic in odi function directly: getCount, Oracle implementation:
    select case count(1) when 0 then 'N' else 'Y' end
    from hr.employees
    when you use this function to refresh a variable, the refresh statement should only be getCount, you shoueld not write select getCount from dual, otherwise it will become
    select select .... from ... from dual
    b. if your logic is complex, I suggest to write function directly in your database, then call this function in your ODI function
    eg:
    CREATE OR REPLACE FUNCTION hr.test RETURN varchar2 IS
    tmpVar NUMBER;
    BEGIN
    select count(1) into tmpVar from hr.employees;
    if tmpVar=0 then
    return 'N';
    else
    return 'Y';
    end if;
    END test;
    then create a ODI function, Oracle implementation is
    hr.test
    in your variable refresh statement, you can write select getCount from dual
    if you use the odi function in other locations expect for refreshing variable, the idea is similar

  • Are Sql functions different from user defined functions ?

    Hello,
    SQL functions are built into Oracle Database and are available for use in various appropriate SQL statements. Do not >confuse SQL functions with user-defined functions written in PL/SQL.according to first paragraph of this document Sql functions are different from user defined functions . How is that ?
    Is they really differ from each other ?

    bootstrap wrote:
    If you don't know what compilation is, please use Wikipedia or other online resources.I know what is compilation . But i was confused whether those sql functions are compiled in my machine when i install Oracle Database in my machine or they are pre-compiled .
    As you said these Sql functions are pre-compiled , it is clear now that they are pre-compiled platform dependent code .
    Can you provide actual source code of any SQL function , say SUM function .
    I want to see it, how they have defined . Eagerly waiting for any reply. please help .
    Edited by: bootstrap on Aug 19, 2011 11:50 AMYou can ask oracle if they give you their code. I doubt they will. However if you want to write you own user-defined aggregation function, there are examples in the documentation how to do that.
    http://download.oracle.com/docs/cd/E11882_01/appdev.112/e17125/adfns_packages.htm#i1008575
    Edited by: Sven W. on Aug 19, 2011 9:24 AM

  • Calling the function NUMBER_GET_NEXT from an XI User Defined Function

    Hi there,
    A number range object has been created on our XI server, called, ZBC_BKSTMT.
    I need to call the function NUMBER_GET_NEXT (standard SAP function for number range objects) with the parameters:
    NR_RANGE_NR = 01
    OBJECT = ZBC_BKSTMT
    Calling the NUMBER_GET_NEXT function will return a unique integer.  However, i need to call it from a User Defined Function because I need to make use of the returned integer in my message mapping.
    Thanks,

    Hello,
    If you have SP13, SAP provides a RFC API which can be called during the mapping. Refer to this document:
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/xi-code-samples/xi%20mapping%20lookups%20rfc%20api.pdf
    Also check this weblog :
    /people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler
    For pre-SP13 systems, refer to this How-To
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/xi-how-to-guides/how%20to%20perform%20sap%20data%20lookups%20within%20xi%20mappings
    ***************Reward points,if found useful

  • Using User Defined Function is SQL

    Hi
    I did the following test to see how expensive it is to use user defined functions in SQL queries, and found that it is really expensive.
    Calling SQRT in SQL costs less than calling a dummy function that just returns
    the parameter value; this has to do with context switchings, but how can we have
    a decent performance compared to Oracle provided functions?
    Any comments are welcome, specially regarding the performance of UDF in sql
    and for solutions.
    create or replace function f(i in number) return number is
    begin
      return i;
    end;
    declare
      l_start   number;
      l_elapsed number;
      n number;
    begin
      select to_char(sysdate, 'sssssss')
        into l_start
        from dual;
      for i in 1 .. 20 loop
        select max(rownum)
          into n
          from t_tdz12_a0090;
      end loop;
      select to_char(sysdate, 'sssssss') - l_start
        into l_elapsed
        from dual;
      dbms_output.put_line('first: '||l_elapsed);
      select to_char(sysdate, 'sssssss')
        into l_start
        from dual;
      for i in 1 .. 20 loop
        select max(sqrt(rownum))
          into n
          from t_tdz12_a0090;
      end loop;
      select to_char(sysdate, 'sssssss') - l_start
        into l_elapsed
        from dual;
      dbms_output.put_line('second: '||l_elapsed);
      select to_char(sysdate, 'sssssss')
        into l_start
        from dual;
      for i in 1 .. 20 loop
        select max(f(rownum))
          into n
          from t_tdz12_a0090;
      end loop;
      select to_char(sysdate, 'sssssss') - l_start
        into l_elapsed
        from dual;
      dbms_output.put_line('third: '||l_elapsed);
    end;
    Results:
       first: 303
       second: 1051
       third: 1515
    Kind regards
    Taoufik

    I find that inline SQL is bad for performance but
    good to simplify SQL. I keep thinking that it should
    be possible somehow to use a function to improve
    performance but have never seen that happen.inline SQL is only bad for performance if the database design (table structure, indexes etc.) is poor or the way the SQL is written is poor.
    Context switching between SQL and PL/SQL for a User defined function is definitely a way to slow down performance.
    Obviously built-in Oracle functions are going to be quicker than User-defined functions because they are written into the SQL and PL/SQL engines and are optimized for the internals of those engines.
    There are a few things you can do to improve function
    performance, shaving microseconds off execution time.
    Consider using the NOCOPY hints for your parameters
    to use pointers instead of copying values. NOCOPY
    is a hint rather than a directive so it may or may
    not work. Optimize any SQL in the called function.
    Don't do anything in loops that does not have to be
    done inside a loop.Well, yes, but it's even better to keep all processing in SQL where possible and only resort to PL/SQL when absolutely necessary.
    The on-line documentation has suggested that using a
    DETERMINISTIC function can improve performance but I
    have not been able to demonstrate this and there are
    notes in Metalink suggesting that this does not
    happen. My experience is that DETERMINISTIC
    functions always get executed. There's supposed to
    be a feature in 11g that acually caches function
    return values.Deterministic functions will work well if used in conjunction with a function based index. That can improve access times when querying data on the function results.
    You can use DBMS_PROFILER to get run-time statistics
    for each line of your function as it is executed to
    help tune it.Or code it as SQL. ;)

Maybe you are looking for

  • Session time out up to # hours for Interaction center

    Hi Experts, I want increase the web ui session time out up to # hours. I tried using SMICM and Technical Profile. But using these options i could not achieve such long session. I tried using RZ 11 icm keep alive parameter, but the effect will apply f

  • BAPI to approve/reject Purchase Requsition

    Hello all - I need some help from SAP gurus. I am looking for two BAPIs - one to approve and one to reject Purchase Requsition item. I am using BAPI_REQUISITION_GETDETAIL and need to approve and reject the purchase requsition that I bring up using sa

  • Can't open I Tunes (Error message)

    I have just tried to open my I Tunes and it is coming up with the following message: The ITunes application could not be opened. An unknown error occured (13026) Does anyone have any ideas? I have tried uninstalling and re-installing but that hasn't

  • C++  Runtime Library Error, terminated by Itunes

    Having just updated to the latest Itunes when Itunes Match begins to upload artwork etc(if I get that far) I get a pop up saying that itunes has terminated in an unusual way Microsoft C++ Runtime Library and itunes shuts down or crashes ( depends on

  • DELVRY03, Idoc is not updating country of origin field

    Hi, I am using DELVRY03 IDOC type for my inbound IDOC, I need to update Country of origin field in delivery ata item level. Using message type SHPCON , there is a segment to hold this value E1EDL35-HERKL, but it is not updating this value in the deli