Calling SQL Server function in ODI

Hi All,
In the Target data store in the interface I have a column called COUNT_BY_CERTDATE column and in the mapping I have teh following syntax, which does not work.
SUM(CASE WHEN ((dbo.getcertdate(person_id,getdate()) >= current_timestamp) THEN 1 ELSE 0 END). The 'getcertdate' is a SQL Server function which returns a date.
I am getting a "Expression is not valid for this DBMS error" with the details as getcertdate is not a recognized built in function name. Please help on fixing this issue.
Thanks for your time and help.

Its defined on the source.
I am getting the following error, when I execute it.
ODI-1228: Task Load_Fact_Table1 (Integration) fails on the target MICROSOFT_SQL_SERVER connection SQLSERVER_USAASC.
Caused By: java.sql.SQLException: [FMWGEN][SQLServer JDBC Driver][SQLServer]Cannot find either column "main" or the user-defined function or aggregate "main.dbo.getCertDate", or the name is ambiguous.
Edited by: ssk1974 on Dec 20, 2012 6:30 AM

Similar Messages

  • Call SQL Server function through the gateway

    Hello, Does anyone know if it is possible to call a SQL Server system function such as SERVERPROPERTY through the gateway?
    I'd like to call a system function in the same way as a user defined function and not using DBMS_HS_PASSTHROUGH.

    Maybe I need to be a little bit more precise. It really depends on the data types being returned. When you look at the SERVERPROPERTY function you mentioned earlier and try to select for example the Collation, then SQl Server will return a SQL_VARIANT data type and that will fail - even using passthrough as SQL_VARIANT is not a supported data type.
    Let me use the passthrough example as it allows me to demonstrate it easily:
    SQL> SQL> declare
      2  val varchar2(100);
      3  c integer;
      4  nr integer;
      5  begin
      6  c:= dbms_hs_passthrough.open_cursor@DG4MSQL_EMGTW_1123_DB;
      7  dbms_hs_passthrough.parse@DG4MSQL_EMGTW_1123_DB (c, 'SELECT  SERVERPROPERTY(''Collation'') as Collation');
      8  LOOP
      9  nr:= DBMS_Hs_Passthrough.fetch_row@DG4MSQL_EMGTW_1123_DB(c);
    10  exit when nr=0;
    11  dbms_hs_passthrough.get_value@DG4MSQL_EMGTW_1123_DB(c,1,val);
    12  dbms_output.put_line(val);
    13  end loop;
    14  dbms_hs_passthrough.close_cursor@DG4MSQL_EMGTW_1123_DB(c);
    15  end;
    16  /
    declare
    ERROR at line 1:
    ORA-28511: lost RPC connection to heterogeneous remote agent using
    SID=ORA-28511: lost RPC connection to heterogeneous remote agent using
    SID=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=emeagtw.de.oracle.com)(PORT=11231)
    )(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=dg4msql)))
    ORA-02063: preceding line from DG4MSQL_EMGTW_1123_DB
    ORA-06512: at line 6
    Process ID: 16919
    Session ID: 148 Serial number: 16721
    When I now make sure the return value is a char data type by slightly modifying the select and including a convert it will work:
    SQL> declare
      2  val varchar2(100);
      3  c integer;
      4  nr integer;
      5  begin
      6  c:= dbms_hs_passthrough.open_cursor@DG4MSQL_EMGTW_1123_DB;
      7  dbms_hs_passthrough.parse@DG4MSQL_EMGTW_1123_DB (c, 'SELECT  convert(char,SERVERPROPERTY(''Collation'')) as Collation');
      8  LOOP
      9  nr:= DBMS_Hs_Passthrough.fetch_row@DG4MSQL_EMGTW_1123_DB(c);
    10  exit when nr=0;
    11  dbms_hs_passthrough.get_value@DG4MSQL_EMGTW_1123_DB(c,1,val);
    12  dbms_output.put_line(val);
    13  end loop;
    14  dbms_hs_passthrough.close_cursor@DG4MSQL_EMGTW_1123_DB(c);
    15  end;
    16  /
    SQL_Latin1_General_CP1_CI_AS
    PL/SQL procedure successfully completed.
    Just in case you have a procedure that returns the correct data type you have to make sure the gateway is configured correctly which means the parameter
    HS_FDS_PROC_IS_FUNC needs to be set to TRUE and the function you want to call is listed in the HS_CALL_NAME parameter.
    Here for a userdefined function I have to specify:
    HS_FDS_PROC_IS_FUNC=TRUE
    HS_CALL_NAME = "dbo.fx_SumTwoValues"
    and then  the udf based select:
    SQL> SELECT "dbo"."fx_SumTwoValues"@DG4MSQL_EMGTW_1123_DB('7','8') AS SumOfTwoValues from "dummy"@DG4MSQL_EMGTW_1123_DB;
    SUMOFTWOVALUES
                15
    - Klaus

  • Calling SQL Server Function from Oracle Database link

    Hi ,
    i have some data from a old SQL server i would i can access with a database link but i cant call function from my database link.
    i would like to do something like
    @SPAN_PROD = Database link
    _EnerttObtApReelBassSys is a Table function from my SQL server
    SELECT *
    FROM "_EnerttObtApReelBassSys('20120504',4,1)"@SPAN_PROD
    WHERE DateEffectiveDebut <= GetDate()
    AND DateEffectiveFin > GetDate()
    any help ?
    Thnx

    951879 wrote:
    I have a SP in SQL Server which will return a Result Set.
    My requirement is to call that procedure in ORACLE using DB Link and insert that resultset(Data) in the temp table.First you need to setup Oracle to SQL Server connectivity. To do that you can either use HS - heterogeneous connectivity which comes for free or use Oracle Transparent Gateway which is not free. HS uses ODBC, so if your Oracle database in not on windows, you'll have to get ODBC SQL Server driver for Unix/Linux (e.g. from EasySoft). Since SQL Server selecting from table function syntax is different from Oracle's you will have to, if you use HS, to use DBMS_HS_PASSTHROUGH package. I never worked with Oracle Transparent Gateway to SQL Server, so I don't know if and how it supports selecting from SQL Server table function.
    SY.

  • SQL Server Functions with TopLink

    I need to call the getDate function in the SQL server database to retrieve the current time. When I try and create a DB Adapter connection to the SQL server database I can click on the Insert/Update/Delete and am able to see the tables.
    When I click on the Stored Procedures/Functions button I get an error. Has anybody out there used the DBAdapter to call SQL Server stored procedures/functions. I have done this with an Oracle database without any problems.
    Thanks,
    Chris

    Chris,
    In Oracle database you can put a function in a query. If you can do the same thing in SQL Server I might have a solution for you. I was able to call functions like count(), max() and min() from SQL Server. Let me know if it might help you and I'll tell you how to do it.
    ~ronen

  • Incorrect syntax errors in sql server function. Please help.

    This is my sql server function:
    create function dbo.CleanTheStringAdv (@theString nvar
    char(500), @CleanMode as int) 
    returns nvarchar(500)  
    begin  
    --define variables
    declare @strAlphaNumeric nvarchar(500)  
    declare @i int
    declare @strChar nvarchar(500)
    declare @CleanedString nvarchar(500)
    --initiate values
    set @CleanedString =''  
    set @theString = @theString + ''
    SET @i = 1
    --Determine if we are looking for numeric values only or numbers and letters
    return case @CleanMode
       WHEN 1
       THEN @strAlphaNumeric = '0123456789'
       WHEN 2
       THEN @strAlphaNumeric = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
       WHEN 3
       THEN @strAlphaNumeric = '|0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
       else 0
     end 
    --Search through chars in the string passed to the function
        while (@i <= Len(@theString))
    begin
    @strChar = substring(@theString, @i, 1)
    If (charindex(@strAlphaNumeric, @strChar) <>0)
    --if the current char being reviewed is valid then add it to the new string
    begin
    @CleanedString = @CleanedString + @strChar
    end
    end
    return @CleanedString
    and below are the syntax errors I see when I press F5:
    Msg 102, Level 15, State 1, Procedure CleanTheStringAdv, Line 24
    Incorrect syntax near '='.
    Msg 102, Level 15, State 1, Procedure CleanTheStringAdv, Line 39
    Incorrect syntax near '@strChar'.
    Msg 102, Level 15, State 1, Procedure CleanTheStringAdv, Line 43
    Incorrect syntax near '@CleanedString'.
    Any help is highly appreciated.....

    Here is the full code for the function:
    create function dbo.CleanTheStringAdv (@theString nvarchar(500), @CleanMode as int)
    returns nvarchar(500)
    as
    begin
    --define variables
    declare @strAlphaNumeric nvarchar(500)
    declare @i int
    declare @strChar nvarchar(500)
    declare @CleanedString nvarchar(500)
    --initiate values
    set @CleanedString =''
    set @theString = @theString + ''
    SET @i = 1
    --Determine if we are looking for numeric values only or numbers and letters
    SET @strAlphaNumeric = case @CleanMode
    WHEN 1
    THEN '0123456789'
    WHEN 2
    THEN '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
    WHEN 3
    THEN '|0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
    else 0
    end
    --Search through chars in the string passed to the function
    while (@i <= Len(@theString))
    begin
    set @strChar = substring(@theString, @i, 1);
    If (charindex(@strAlphaNumeric, @strChar) <>0) --if the current char being reviewed is valid then add it to the new string
    begin
    SET @CleanedString = @CleanedString + @strChar;
    end
    END
    return @CleanedString;
    END

  • How can I call a server function by a button?

    Hello, world...
    I have a problem...
    I need to call a server function by pushing a button. I put the condition on the label...
    This is my script:
    writeBtn1.addEventListener (MouseEvent.CLICK,writeFile1);
    private function writeFile1 (e:MouseEvent=null):void
                 checkBtn = (writeBtn1.label == "Conferma" && textInput1.text != "" );  //my condition...
                 if (checkBtn)
                     nc.call ("WriteNow",null,textInput1.text+"\n");
                    writeBtn1.label = "Fatto";
    I'd like to call the function on the release of the button...
    Can someone helps me?
    Please...
    Emiliano.

    use:
    writeBtn1.addEventListener (MouseEvent.CLICK,writeFile1);
    writeBtn2.addEventListener (MouseEvent.CLICK,writeFile1);
    writeBtn3.addEventListener (MouseEvent.CLICK,writeFile1);
    private function writeFile1 (e:MouseEvent=null):void
                if(e.currentTarget==writeBtn1){
                 // do whatever
               } else if(e.currentTarget==writeBtn2){
                 // do whateverelese
              } else {
                 // it's writeBtn3

  • Running SQL Server Function and Procedures from Oracle

    I am trying to run SQL Server 2005 functions and/or procedures from a SQL statement in Oracle. I have gone throught the hetergeneous services and have connected to the SQL Server database successfully. I can also do a query to a table in SQL Server successfully; but I have not been able to execute a procedure or a function.

    Have you tried Oracle syntax? It seems to me that you have only tried T-SQL syntax, e.g. execute proc.
    Wrap it in a begin..end tag like you would a normal PL/SQL function or proc call. Assumption is that as Oracle makes the remote database (via the dblink) look like an Oracle database, you should also play along and pretend it is one and treat it as such.
    E.g.declare
      r integer;
    begin
      -- execute remote proc
      procFoo@dblink( 'ABC' );
      -- call a remote function
      r := funcFoo@dblink( 123 );
    end;

  • How to use evaluate function for sql server function

    Hi Team,
    We have imported a column(date dtat type) from SQL server cube . By default it imported as varchar,. We have three option in physical layer for this column(Varchar,Intiger,unknown)
    So we want to convert this column into date.can we use evaluate or there is any option to do that.?

    Hi,
    I am not sure your requirement. But how pass evaluate function obiee?
    syntax:- EVAULATE('your db function(%1,%2)', parameter list)
    here %1 and %2 are the no.of parameters (columns or may constant values) to be passed for the db-function
    if you have 3 parameters then you need to use %3 also.. means the columns to be passed.
    following exapmples are for ORACLE db,
    ex1: EVALUATE('upper(%1)', 'satya ranki reddy') gives the result as -> SATYA RANKI REDDY
    ex2: EVALUATE('upper(%1)', 'Markets.Region') here Markets.Region is column.
    you also can call the user-defined functions through evaulate
    EVALUATE('functioname(%1,%2), column1, column2)
    the above function has 2 parameters to be inputted
    Hope this help's
    Thanks
    Satya

  • How To Call SQL Server SP's in Oracle 11G

    Hi
    I have sucessfuly established the connectivity between Oracle 11G and SQl Server 2008 and I am able to select the data from views or tables of sql server in oracle.
    but now I have 1 issue I am not able to call or execute the SP's or function of sql server in oracle 11G.
    Can you please suggest or help me.
    Thanks
    Regards
    Anant.

    Anant,
    Which gateway are you using to connect to SQL*Server ? Is it the Database Gateway for SQL*Server (DG4MSQL) or Database Gateway for ODBC (DG4ODBC) ?
    If it is DG4MSQL then have a look at this note in My Oracle Support -
    Different Methods For Calling MS SQL Server Procedures Using DG4MSQL (Doc ID 197192.1)
    If you still have problems using DG4MSQL then post an example of what you are trying to do and the errors you receive.
    If you are using DG4ODBC then this does not support calling remote stored procedures.
    Regards,
    Mike
    Edited by: mkirtley on Aug 8, 2012 3:32 PM

  • Invoking SQL Server function from Oracle

    Hi all,
    My question involves Oracle and SQL Server. I have a function in SQL Server that returns the count of rows in a table in SQL Server itself. I
    wish to invoke this function (in SQL Server) from Oracle. I have Transparent Gateway through which I usually connect to SQL Server to get the count. Is there a way in which I can execute the function (in SQL Server) from Oracle, something like below:
         select function_in_sql_server@transparent_gateway from dual;Thanks,
    ...

    I found below two links:
    how to call a sql server stored procedure from oracle
    http://en.allexperts.com/q/Oracle-1451/2008/6/Calling-SQL-Stored-procedure-1.htm
    Regards
    Girish Sharma

  • BI Publisher 11g - calling SQL Server 2005 stored procedure error

    Hi experts
    I have been calling succesfully an SQL server 2005 stored procedure for the data model of a BI publisher report in 10g, passing it a customerNo parameter.
    EXEC     [dbo].[usp_WelcomeLettersConsumerNo]
              @CustomerNo = :sCustomerNo
    However it does not work in 11g I get the error:
    [Hyperion][SQLServer JDBC Driver][SQLServer]Incorrect syntax near the keyword 'is'.
    which is frustrating as there is no 'is' in the statement (perhaps it is picking up :s?) - I wonder does anyone know if there has been a change in 11g that may be causing this?
    cheers
    Tim

    Hi experts
    I have been calling succesfully an SQL server 2005 stored procedure for the data model of a BI publisher report in 10g, passing it a customerNo parameter.
    EXEC     [dbo].[usp_WelcomeLettersConsumerNo]
              @CustomerNo = :sCustomerNo
    However it does not work in 11g I get the error:
    [Hyperion][SQLServer JDBC Driver][SQLServer]Incorrect syntax near the keyword 'is'.
    which is frustrating as there is no 'is' in the statement (perhaps it is picking up :s?) - I wonder does anyone know if there has been a change in 11g that may be causing this?
    cheers
    Tim

  • Calling SQL Server Script File in Hypersonic DB

    HI All,
    I am using Hypersonic Database with java swing.
    To update the database, i am getting SQL Server script file through a webservice.
    The problem is i dont have any idea, how i can update Hypersonic Database with the SQL Server script file.
    Please Help.
    Thanks
    Nitin

    Also I think
    CREATE TABLE table1
    ( tableoneid INT PRIMARY KEY NOT NULL
    , name VARCHAR(255) NOT NULL
    , PRIMARY KEY(tableoneid) );should probably be
    CREATE TABLE table1
    ( tableoneid INT CONSTRAINT table1_pk PRIMARY KEY
    , name VARCHAR(255) NOT NULL );otherwise you specify the primary key twice (and PRIMARY KEY implies NOT NULL so the NOT NULL is redundant).
    Then TABLE2 might need to be something like:
    CREATE TABLE table2
    ( tabletwoid INT NOT NULL
    , tableoneid NOT NULL CONSTRAINT table2_table1_fk REFERENCES table1
    , CONSTRAINT table2_pk PRIMARY KEY(tabletwoid, tableoneid) );although the table-level constraint syntax could be used for the foreign keys if it meant less editing of your scripts. The "CONSTRAINT constraintname" clause of constraints is optional but recommended, as otherwise they will get system-generated names like "SYS_C005157". (Note that if you specify the FK inline as part of the column definition you do not need to include a datatype.)
    If the IDENTITY clause causes a sequential value to be assigned as a default, there is no direct equivalent to that in Oracle. The nearest thing would be a row-level BEFORE INSERT trigger.

  • Call SQL Server Stored Procedure from BPEL

    Could somebody send me the tutorial on how to use Stored Procedures for SQL Server (as mentioned by mchiocca in this thread: Stored Procedure Support?
    [email protected]
    Thanks!

    This is not a possibility.
    Refer to Support for Non-Oracle Stored Procedures

  • I see most recent file is called sql server log shipping work file

    What is "SQL server log shipping work file"?

    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/62a6556e-6655-4d19-9112-1788cf7bbcfc/wrk-file-in-logshipping-2005
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • SQL server connectivity on ODI installed on SOALRIS

    Hi All,
    Our development environment is WINDOWS. We have developed a code with SQL server as source. It is working fine on WINDOWS. We have kept sqljdbc4.jar in drivers and used JDBC driver as com.microsoft.sqlserver.jdbc.SQLServerDriver and JDBC Url as jdbc:sqlserver://<db_name>:1433.
    Now we are trying to migrate the code to SOLARIS environment. I am accessing the UI using windows but the agent is pointing to SOLARIS box. When I test the connection i get a java.lang exception. Any thoughts?
    The issue is on high priority so any help is appreciated.
    Thanks,
    Vikram

    See if this links help you http://docs.oracle.com/cd/E21764_01/integrate.1111/e12644/ms_sqlserver.htm#BGBJBGCC
    You can also try the Microsoft SQL SERVER JDBC Driver http://msdn.microsoft.com/en-us/sqlserver/aa937724

Maybe you are looking for

  • How to adjust line sampling frequency in photoshop CC on surface pro 3

    I just got a Surface Pro 3 so that I could work on my art on the go. I am used to working on a mac with a cintiq, but fell for the hype that photoshop was optimized to work with SP3. However, when I try to use the brush tool, my lines look AWFUL! no

  • White screen when charging. Is this normal?

    I just purchased the 8gb itouch (2nd gen). So far I love it. However, something that seems odd happend twice in the first night that I have had it. With the itouch turned off yet connected to the computer, after a short while I look over at it and th

  • RAR Uploading Textobjects fails

    Hi, we have following issue: The upload of text-objects (downloaded from the backend by program /VIRSA/ZCC_DOWNLOAD_DESC ) to RAR doesn't work for us. We download one language only, called the file SAPtext.txt and we have chosen the appropriate menu

  • Command Prompt change to user directory

    I am a mac user who is use to the Terminal. On Windows I am trying to set the command prompt to always start at: c:\Users\Username> instead of C:\Windows\System32> I have found a lot of win2000 directions and Win7 but have not been able to find the d

  • Report which displays operation allocation in Routing CA03

    Hi Experts, I want to display a report showing operation allocation for each BOM components in the routing transaction CA03. The selection screen fields are Bill of Material header, Group, Group Counter, Plant, BOM, and alternative BOM. The output of