Instr function in Informatica

Use IS_NUMBER to test data before using one of the numeric conversion functions, IIF( IS_NUMBER ( ITEM_PRICE ), TO_FLOAT( ITEM_PRICE ), 0.00 )ITEM_PRICE RETURN VALUE '123.00'        123 '-3.45e+3'     -3450 '3.45E-3'       0.00345 '    '              0.00   Consists entirely of blanks ''                  0.00   Empty string '+123abc'     0.00 ''  123ABC'  0.00 'ABC'         0.00 '-ABC'         0.00 NULL         NULL  Hpoe this helps! Regards,Veeru

Hello All, I have got a scenario to implement: I have a Character source column which I need to convert to Numeric(18,4) and load into table. My source and target is a Netezza table. If the conversion fails, we do not drop the record, instead insert NULL for those records,i.e. source and target has same number of records. I use an expression as below : DECODE(Input_String, NULL, NULL-- Check for alphabets IIF((UPPER(Input_String) != LOWER(Input_String)), NULL-- Check for special charactersIIF((INSTR(Input_String,',',1) > 0 || INSTR(Input_String,':',1) > 0 || INSTR(Input_String,'@',1) > 0),NULL, TO_DECIMAL(Input_String,4))    )       ) Now my question is, can we use a single INSTR statement and check for all the special characters? I want to avoid writing multiple INSTR statements. Please suggest me how to check multiple characters in a single INSTR statement. Thanks & RegardsBiswajeet.

Similar Messages

  • Error while using CURRENTMEMBER property in INSTR function

    Hi,
    I am looking for SQL 'LIKE' operator equivalent solution in MDX and I tried the below query.
    SELECT FILTER([Company].Members, INSTR([Company].CURRENTMEMBER.NAME,"AA") >0) on columns from temp1.db
    The above query is not compiling due to CURRENTMEMBER propery in INSTR function.
    When I replaced [Company].CURRENTMEMBER.NAME with a constant "AABB", then the query is working fine.
    SELECT FILTER([Company].Members, INSTR("AABB","AA") >=0) on columns from temp1.db
    Also, CURRENTMEMBER is working fine outside INSTR function.
    SELECT FILTER([Company].Members, [Company].CURRENTMEMBER.[GEN_NUMBER] = 1) DIMENSION PROPERTIES GEN_NUMBER on columns from temp1.db
    Is CURRENTMEMBER property not supported in INSTR? I am using Hyperion Provider Services 9.3.1.
    Is there any other solution for SQL 'LIKE' operator equivalent in MDX?
    Thanks in advance,
    Anil.

    With Essbase 9.3.1 it ought to work. The following is a simple query that works for me:
    select
      filter (
           [Market].Members,
           Instr (1,
                [Market].CurrentMember.MEMBER_NAME,
                "e"
           ) > 0
      ) on axis(0)
      from [Sample.Basic]
      ;

  • Dynamic PL/SQL & substr, instr function

    I am having trouble with incorporating the SUBSTR and INSTR functions into my dynamic PL/SQL procedure using Oracle 8i.
    I have data that is packed into one column seperated by a delimiter (':')
    I need to seperate the data to use indicidual pieces.
    If I run my query in general -
    select substr(secondcol, 1, instr(secondcol, ':',1,1)-1) ONE,
    substr(secondcol,instr(secondcol, ':',1,1)+1,instr(secondcol, ':',1,1)-1) TWO,
    substr(secondcol,instr(secondcol, ':',1,2)+1,instr(secondcol, ':',1,1)-1) THREE,
    substr(secondcol,instr(secondcol, ':',1,3)+1,instr(secondcol, ':',1,1)-1) FOUR
    from temp_table where firstcol=100
    This works and gives me the right result.
    e.g
    DATA :
    Firstcol SECONDCOL
    100 1:2:3:4
    Result:
    ONE TWO THREE FOUR
    1 2 3 4
    However to make this generic if I use it in a function passing it a parameter which has ':' delimited data it does not work and gives me errors. All I want is to get the output as a string that looks like my query above so I can use it in my proc.
    create or replace function MYJUNK(TFieldNew IN CHAR)
    RETURN CHAR IS
    UpdateString Varchar2(100);
    BEGIN
    UpdateString := 'First=substr('||TFieldNew||', 1, instr('||TFieldNew||', '':'',1,1)-1) ONE, ';
    UpdateString := UpdateString || ' Second=substr('||TFieldNew||', instr('||TFieldNew||', '':'',1,2)+1, instr('||TFieldNew||', '':'',1,1)-1) TWO, ';
    UpdateString := UpdateString || ' third=substr('||TFieldNew||', instr('||TFieldNew||', '':'',1,3)+1, instr('||TFieldNew||', '':'',1,1)-1) THREE from temp_table';
    return UpdateString;
    END;
    The function compiles but gives me run time errors
    This is what I get -
    SQL> select myjunk('''1:2:3:4''') from dual;
    select myjunk('''1:2:3:4''') from dual
    ERROR at line 1:
    ORA-06502: PL/SQL: numeric or value error
    ORA-06512: at "SGHDTA.MYJUNK", line 8
    ORA-06512: at line 1

    You are getting an error because updatestring is longer than the 100 characters you defined it as. Try using VARCHAR2(4000). Also, if you are trying to generate the sql statement, you need to get rid of first=, second= and third= when you build the string.
    This is what your function returns. I put in line breaks for clarity:
    First=substr('1:2:3:4', 1, instr('1:2:3:4', ':',1,1)-1) ONE,
    Second=substr('1:2:3:4', instr('1:2:3:4', ':',1,2)+1, instr('1:2:3:4',':',1,1)-1) TWO, 
    third=substr('1:2:3:4', instr('1:2:3:4', ':',1,3)+1,instr('1:2:3:4', ':',1,1)-1) THREE
    from temp_tableIf you are trying to actually parse the column, then you need something more like:
    create or replace procedure MYJUNK(TFieldNew IN VARCHAR2,out1 OUT VARCHAR2,
                                       out2 OUT VARCHAR2, out3 OUT VARCHAR2) is
    BEGIN
       out1 := SUBSTR(TFieldNew,1, INSTR(TFieldNew,':',1,1)-1);
       out2 := SUBSTR(TFieldNew, INSTR(TFieldNew,':',1,2)+1, INSTR(TFieldNew,':',1,1)-1);
       out3 := SUBSTR(, INSTR(TFieldNew,':',1,3)+1, INSTR(TFieldNew,':',1,1)-1);
    END;

  • Urgent - INSTR() Functions in OBIEE?

    Hi All,
    I just got some very good help from the DB experts on these forums about solving a problem with a table join that I had.
    But now I have this SQL query and I'm trying to figure out how to implement this in OBIEE:
    select *
    from TABLE1,TABLE2
    where instr(TABLE2.USER_ID,TABLE1.USER_ID) > 0
    My question is how do I implement this instr() function on OBIEE? I checked physical and business model mapping layers in the repository and it does not allow me to configure this type of join. Is it possible to configure this type of join function to be invoked automatically everytime a user runs a certain query in OBIEE (as if it was a natural join)?
    Any help would be greatly appreciated.
    Alan

    Hi,
    You can refer the below links,
    Substring instr issue in obiee
    extract a string from a string
    http://108obiee.blogspot.in/2009_10_01_archive.html
    Award points it is useful.
    Thanks,
    satya

  • How to use instr functions?

    Hi guys,
    I have a table like this:
    name data
    a 10101000U000
    b 011U11001100
    c 0U1001001001
    d 01U010100010
    I want to get the position of "U" in data column, like:
    name position of U
    a 9
    b 4
    c 2
    d 3
    what should I do? I use "instr" function, but failed. can anyone help me on this?
    Thanks.

    Example for you:
    [email protected]> select instr('10101000U000','U') from dual;
    INSTR('10101000U000','U')
    9
    [email protected]> select instr('011U11001100','U') from dual;
    INSTR('011U11001100','U')
    4
    Best Regards
    Krystian Zieja / mob

  • How to check multiple special characters in instr function sql query.

    Hi,
    The following special characters are comma(,), slash(/), colan(:)
    these special characters i need to be check in instr function.
    select SUBSTR(master_title,1,INSTR(master_title,',',1,1)-1) from dual;
    Can you please write the query with right answer.
    Thanks in advance,
    Lakshman.

    Why multiple post?
    How to check multiple special characters in this query.

  • Use of xdofx:Instr function in a RTF template

    I'm trying to use the xdofx:Instr function within a RTF template but am running into problems because the code produces an error. The following code worked before the data changed:
    <?if:number(DS_SEQ)=1 and( M_TRANTYPE='F')?>
    Now my M_TRANTYPE comes back as 'F,H' so I thought I would use the xdofx:Instr function. I redid the RTF code to read:
    <?if:number(DS_SEQ)=1 and( xdofx:Instr(M_TRANTYPE,'F',1)>0 )?>
    but this fails. I've tried other combinations but they also fail:
    <?if:xdofx:Instr(M_TRANTYPE,'F',1)>0 ?>
    <?if: xdofx:Instr('abc','a',2) >0?>
    Can the xdofx:Instr be used in an "if" construct or am I missing something about its proper use?
    Alex.

    Alex,
    Instr appears to be fine... check the xdofx syntax.
    i.e.
    <?xdofx: if Instr(M_TRANTYPE,'F',1)>0 then DISPLAY_XXX end if?>
    regards,
    Rownald

  • Help needed for Instr function

    Hi,
    I using instr function to find the delimiter '|' .the function does retrives value , if the character contains
    special charcater. (i.e)INSTR('Carán|','|',1,6) returns
    only zero as the value , which is not correct. kindly suggest me some solution for the above problem.
    Thanks in advance.

    By INSTR('Carán|','|',1,6) , you are trying to find location of 6th occurance of special character '|' . Since there is no such occurence, it is returning 0.
    sql> select instr('Caran|','|') from dual;
    INSTR('CARAN|','|')
    6
    Thanks

  • SUBSTR and INSTR function

    Hi Gurus,
    I have the data as follows:
    data
    'BIDIE01H/TXT:ZUNE=HA011, CellIndex=144 /CAI:452-01-32201-47001/CAI:45201F7dc9b79a'
    'BIDIE01H/TXT:ZUNE=HA111, CellIndex=124 /CAI:452-01-32201-471/CAI:45201F7dc9b79b'
    and I am trying to write a SQL to get the results:
    CAI
    452-01-32201-47001
    452-01-32201-471
    Any idea to get it done? I did try around with SUBSTR and INSTR functions but not yet sucessed.
    Thanks,
    Alex

    select substr (str, instr (str, '/CAI:') + 5
                  , (instr (str, '/CAI:', -1) - instr (str, '/CAI:'))-5
      from dataas in
    SQL> with data
      2  as
      3  (select 'BIDIE01H/TXT:ZUNE=HA011, CellIndex=144 /CAI:452-01-32201-47001/CAI:45201F7dc9b79a' str from dual union all
      4  select 'BIDIE01H/TXT:ZUNE=HA111, CellIndex=124 /CAI:452-01-32201-471/CAI:45201F7dc9b79b' from dual
      5  )
      6  select substr (str, instr (str, '/CAI:') + 5
      7                , (instr (str, '/CAI:', -1) - instr (str, '/CAI:'))-5
      8                )
      9    from data
    10  /
    SUBSTR(STR,INSTR(STR,'/CAI:')+5,(INSTR(STR,'/CAI:',-1)-INSTR(STR,'/CAI:'))-5)
    452-01-32201-47001
    452-01-32201-471

  • Convert varchar to date in BO Universe with Substring and instring function

    to_date(substr(xxxx_v.e_details,instr(xxxx_v.e_details,'|',1,2)+1,9),'DD-MM-YYYY') In the universe while defining the object as date i was facing probs can any body help me out. the column xxxx_e_details is having the datatype varchar in database and the third string is date while i was creating the date object in the universe with the above syntax it was getting the error
    The data in this obect is like this xxxx_v.e_details -> wwww|eeee|MM-DD-YY|
    Edited by: mohammed kashif on Mar 31, 2011 11:47 AM

    i am getting the data but  it is in the format 01-03-0201. The year format  for 2010 is populating as 0201. i am not able to think whether it is due to instring function which is reading data like this. Need suggestion from experts.............

  • Set variable to result of instr function

    I am trying to set a variable to the result of the instr function. I am getting the error Caused by: oracle.xdo.parser.v2.XPathException: Namespace prefix 'xdofx' used but not declared.
    My code is as is below <?xdoxslt:set_variable($_XDOCTX,’POS1’, xdofx:Instr (LINE_ITEM_DESCRIPTION,'|',1,1))?>
    I know in the documentation it says "You cannot mix xdofx statements with XSL expressions in the same context" is this such a case? If so how do I go about getting the result of Isntr into a variable?
    Thanks a ton

    Try using the below code
    <?xdoxslt:set_variable($_XDOCTX,’POS1’, xdoxslt:instr(LINE_ITEM_DESCRIPTION,'|',1,1))?>

  • What's the reason behind adding ':'|| and ||':' to items in INSTR function?

    Hi,
    I noticed in examples that when the INSTR function is used items and the search strings are preceeded/followed by ':'|| and ||':' and I was just wondering why this is so. Does this not just add a : to the start and finish of the item and string? Is there an advantage over just coding it like so:
    instr(upper(OBJECT_ID), upper(:P18_OBJECT_ID)) > 0)
    rather than
    instr(':'||:P18_STATUS||':',':'||STATUS||':') > 0
    Cheers,
    simon.

    Simon,
    I don't know about the instr vs. like question. For the other question, I've seen this used mostly for checking for the presence of a token within a colon-delimited string of values. Consider:
    ******** Right Answer ********
    SQL> select 1 from dual where instr(':'||'CREATE:UPDATE:DELETE:'||':', ':'||'CREATE'||':') > 0;
    1
    1
    ******** Wrong Answer ********
    SQL> select 1 from dual where instr('CREATE:UPDATE:DELETE:', ':'||'CREATE'||':') > 0;
    no rows selected
    ******** Right Answer ********
    SQL> select 1 from dual where instr(':'||'CREATE:UPDATE:APPLY_CHANGES:DELETE:'||':', ':'||'APPLY'||':') > 0;
    no rows selected
    ******** Wrong Answer ********
    SQL> select 1 from dual where instr(':'||'CREATE:UPDATE:APPLY_CHANGES:DELETE:'||':', 'APPLY') > 0;
    1
    1
    Scott

  • INSTR() function is taking more time

    im using the below query select query in my procedure.
    select distinct SUPPLIER_CIRCUIT_ID from SUPPLIER_DATA
    where INSTR(i.SYSTEM_CIRCUIT_ID,SUPPLIER_CIRCUIT_ID) > 0;
    I am taking SYSTEM_CIRCUIT_ID in cursor.
    This query is taking more time. Is that possiblt to create function based index and speed up the query?

    Hi,
    Welcome to the forum!
    993620 wrote:
    im using the below query select query in my procedure.
    select distinct SUPPLIER_CIRCUIT_ID from SUPPLIER_DATA
    where INSTR(i.SYSTEM_CIRCUIT_ID,SUPPLIER_CIRCUIT_ID) > 0;
    I am taking SYSTEM_CIRCUIT_ID in cursor.Show exactly what you're doing.
    Whenever you have a problem, post a complete test script that people can run to re-create the problem and test their ideas.
    See te forum FAQ {message:id=9360002}
    This query is taking more time. Is that possiblt to create function based index and speed up the query?Sorry, unless you doing something very specific (such as alwyas looking for the same sub-string) then a function-based index won't help.
    Oracle sells a separate product, called Oracle Text, for this kind of searching.
    You might try LIKE:
    WHERE  i.SYSTEM_CIRCUIT_ID LIKE  '%' || SUPPLIER_CIRCUIT_ID || '%'If you're using a cursor, then that's probably slowing the process down much more than the part you're showing.

  • Translate function of oracle, equivalent function in informatica?

    Hi All,
    I know its off topic but i am stuck very very badly and this place turns out to be he best for my issues, here is my problem:
    lets say i hve fname coming from a flatfile and the first name is 'rahul' , it should be translated as '12345' usin informatica function, now lets say the 2nd name comes which is 'rohit' it should be translated as '1o3it'. I hope my problem is clear, please help me out.
    Regards
    Rahul Kalra
    Edited by: Mac_Freak_Rahul on Aug 10, 2011 3:18 AM

    Something like this ? (just to play with) I know Informatica just by name so I don't have the faintest idea about what if the third name shows up
    I don't have a database at hand so I don't dare to produce a sql (using model clause or xmlagg) solution
    declare
      l_rahul varchar2(9) := 'rahul';
      l_rohit varchar2(9) := 'rohit';
      l_char  varchar2(1);
      l_result varchar2(9) := '';
      for i in 1 .. length(l_rahul)
      loop
        l_char := substr(l_rohit,i,1);
        if substr(l_rahul,i,1) = l_char then
          l_result := l_result || to_char(i);
        else
          l_result := l_result || l_char;
        end if;
      end loop;
      dbms_output.put_line(l_result);Regards
    Etbin

  • Xsl fo doubt for instr function

    Can anyone please advice if I can use instr and substring functions in xsl fo?
    my issue is that i have a lon email address which needs to be wrapped up in 2 lines
    Always my email ends with 'v'
    So I tried to do this
    <xsl:value-of select="substring(BUYER_CONTACT_EMAIL,1,instr(BUYER_CONTACT_EMAIL,'@'))"/>
    <xsl:value-of select="substring(BUYER_CONTACT_EMAIL,instr(BUYER_CONTACT_EMAIL,'@')+1,instr(BUYER_CONTACT_EMAIL,'v',-1))"/>
    It throwed me error
    Any idea
    KP

    Instead of
    <xsl:value-of select="substring(BUYER_CONTACT_EMAIL,1,instr(BUYER_CONTACT_EMAIL,'@'))"/>
    use
    <xsl:value-of select="substring-before(BUYER_CONTACT_EMAIL,'@')"/> <xsl:value-of select="substring-after(BUYER_CONTACT_EMAIL,'@')"/>

Maybe you are looking for

  • How can I remove the scroll buttons on the firefox 4 context menu?

    My display is set to 1600x1200 and the apparently fixed size for context menus with scroll arrows at the top and bottom make using firefox 4 a bit inconvenient. Is there any way to eliminate these scroll buttons and revert to the firefox 3 style of c

  • DEFTAX_ITEM table updation problem

    Dear All, We are using SAP Ecc 6.0 We have configured service tax  through deferred tax codes. Created Profit center wise Service TAx code and working Fine. Also we are executing S_AC0_52000644 - Deferred Tax Transfer  Procedure and working fine. Now

  • Accessing user_tables and user_tab_columns of oracle from java

    hi, i can not access "user_tables" and "user_tab_columns" from java code while i can access them from TOAD.I connect to the database "HR", which is a sample database of oracle, as "normal".When i write: @Entity @Table(name="user_tab_columns") public

  • Passing an Internal table to a "Z" class

    Hi, I am new to ABAP Objects. I am developing a "Z" class and would like to pass an internal table to this "Z" class. How do I pass it. What declarations do I need to make in the "Z" class and where? Thanks in advance. Mick

  • WebAccess Maximum Message/Attachment Size?

    Is there a way to limit the size of messages (or attachments) with GroupWise WebAccess 8.0.2? I've set the size limit for the domain (Client Options --> Disk Space Mgmt --> Maximum Message Size) which is working great for my Win32 clients. It doesn't