Instr and substr function in oracle issues

hi all
I have an issue to split my filename
Filename is as below:
ABCD01_123456789_samplename_13062012_10062012-12-12-12-1.PDF
my output as below
Col1          Col2                 col3                 col4            col5             col6
ABCD01    123456789               samplename            13062012    10062012    10062012-12-12-12-1.PDFcan you please help me to split this using any simple method
thanks ain advance
Edited by: A on Jun 12, 2012 8:25 PM
Edited by: A on Jun 12, 2012 8:25 PM

>
can you please help me to split this using any simple method
>
You can split the string into rows using the same technique used in this example
http://nuijten.blogspot.com/2009/07/splitting-comma-delimited-string-regexp.html
Just replace the ',' with an underscore.
Then you can convert the rows to columns using LISTAGG like this example
http://www.oracle-base.com/articles/misc/string-aggregation-techniques.php
Search the forum for 'rows to columns' and you will find plenty of other alternatives.

Similar Messages

  • PL-SQL Solve: Using INSTR and SUBSTR

    I am trying to work on this and cannot get a solution. Please help
    You have to use INSTR and SUBSTR to solve
    Question:
    You have the following acceptable value
    Numberic: 0-34
    80-100
    or Non Numberic X S U D- D D+
    Im have to use INSTR and SUBSTR functions to test that the value is a valid (as above) number before TO_NUMBER is called:
    SELECT TO_NUMBER('?? ') //HERE ?? and a space (for 100 etc) is for the values as above
    FROM DUAL
    WHERE ....INSTR(......)<=;
    (Hence if the number is true then number comes back or it says no rows)
    and also id non numberic it should also be tested.
    I am completely unsure about it but tried this
    SELECT TO_NUMBER('34 ')
    FROM DUAL
    WHERE INSTR('0123456789',1,1)<=9 (looking at first number ?)
    AND
    INSTR('0123456789',2,2)<=9
    AND
    INSTR('0123456789',3,3)=0;
    Please help

    We have the following value that we can use:
    Numeric: 0-34 and 80-100 only
    or Non Numberic X S U D- D D+
    Have to use INSTR and SUBSTR functions to test that the value is a valid
    (for now only trying to create a function which can later be put into a procedure.)
    SELECT TO_NUMBER('12 ') //e.g HERE 12 and a space for the values as above
    FROM DUAL
    the where clause looks at all three spaces to make sure values are correct (given number or non-numberic values only)
    (Hence if the number is true then number comes back (meaning true)
    or it says NO rows)
    If value is non numeric, test it to allow non numberic also.
    I am completely unsure about it but tried this
    SELECT TO_NUMBER('34 ')
    FROM DUAL
    WHERE INSTR('0123456789',1,1)<=9 (looking at first number ?)
    AND
    INSTR('0123456789',2,2)<=9
    AND
    INSTR('0123456789',3,3)=0;
    Something like this has to be done.....subst (instr, x,x,) i think mite help.

  • Some instr and substr fundamental

    Hi,
    In a procedure, my input parameter would be 123,345,456,567......I will put this in a loop..
    My requirement is like first it will take 123 and i will do some calculation end loop,
    then 345 and i will do some calculation end loop,
    then 456 and i will do some calculation end loop,
    then 567 and i will do some calculation end loop, and so on...
    i think there is some instr and substr fundamental..
    Will be great if i get some suggestion to solve the issue...
    Thanks,
    HP

    Not quite.
    Dbms_utilty.comma_to_table will do the job quite nicely.
    http://www.java2s.com/Code/Oracle/System-Packages/demonstratestheuseofDBMSUTILITYTABLETOCOMMAandDBMSUTILITYCOMMATOTABLE.htm
    Sybrand Bakker
    Senior Oracle DBA

  • Please help me : SUBSTR function in Oracle 6i

    Dear all people!
    I have a problem with SUBSTR as follow:
    my code:
    declare
    string1 varchar2(300);
    string2 varchar2(65);
    begin
    string1 := ....
    string2 := substr(string1,1,60);
    end;
    when i run program in debug
    at command "string2 := substr(string1,1,60);" it raise error ORA-06502;
    Please tell me how to assign substr(string1,1,60) to string2 (max length of string2 is 65);
    I'm looking to forward to receiving your response!
    Thank you very much;

    The question was simple:
    I am trying to do is bring in anything after the * in the Id column no matter how long the name is before the * but my calculation is way off L:
    Here is an example of what my data would look like but what I need it to do:
    Id                                                        NEW COLUMN
    TNET*231333                                  231333
    AMER*29283893.2                       29283893.2
    TNEY*21893838                             21893838
    Do you know how to create this calculation?
    Answer: SUBSTR(id,INSTR(id,'*',1)+1,999)
    this was emailed to me from someone on here saying "try to see if this helps" and it did that's why i said thank you.

  • PATH and UNDER_path functions in ORACLE 11gR2 for Windows.

    I am now getting the error -01405 when I use the function and predicate PATH UNDER_PATH path_string use the parameter function. If instead you use a literal value everything works fine. I found that if I delete from the list select the same path expression works well. example:
    SELECT PATH(1), e.xmldata.dispname FROM xdb.xdb$resource e
    WHERE UNDER_PATH(VALUE(e),funcionRetornaUnPath,1) = 1
    !!!!Error ora - 01405
    SELECT PATH(1), e.xmldata.dispname FROM xdb.xdb$resource e
    WHERE UNDER_PATH(VALUE(e),'/pathxxxx',1) = 1
    !!!! OK.
    SELECT e.xmldata.dispname FROM xdb.xdb$resource e
    WHERE UNDER_PATH(VALUE(e),funcionRetornaUnPath,1) = 1
    !!! Ok.
    Thank´s
    Edited by: 900197 on 01-dic-2011 11:34

    Hi,
    First of all, you shouldn't be using XDB$RESOURCE directly but RESOURCE_VIEW or PATH_VIEW instead.
    It doesn't solve the problem entirely but there's no error if we declare the function DETERMINISTIC.
    However the PATH function returns NULL :
    SQL> create or replace function fnc_test return varchar2
      2  deterministic
      3  is
      4  begin
      5   return '/public';
      6  end;
      7  /
    Function created
    SQL> select path(1), v.any_path
      2  from resource_view v
      3  where under_path(v.res, fnc_test(), 1) = 1
      4  ;
    PATH(1)               ANY_PATH
                          /public/dump
    Could you post again in the {forum:id=34} forum?
    Thanks.

  • Informix- Oracle migration: OMWB misapplies SUBSTR function !!!

    New problem occured:
    OMWB translates Informix's substrings wrong:
    Examples of translations:
    INFORMIX ORACLE
    wvs[1] SUBSTR(wvs,1)
    wvs[2,10] SUBSTR(wvs,2,10)
    wvs[10] SUBSTR(wvs,10)
    It seems, that OMWB only copies index numbers in square brackets as parameters of Oracles's SUBSTR function. But SUBSTR works differently by string indexes closed to [] in Informix !
    wvs[1] means 1-st character of wvs string, wvs[3,5] means substring from 3-rd to 5-th character of wvs (length 3), but SUBSTR(wvs,1) means substring from 1-st chracter to end of string, SUBSTR(wvs,3,5) means 5-characters long substring from 3-rd to 7-th character, e.t.c.
    Vladimir Kubanka alias Bare Foot
    null

    Well, I obtained <process_id> from V$SESSION, (...WHERE audsid=to_number(sessid) , ... , sessid:= sys_context('USERENV','SESSIONID') ).
    But problem: this process_id is not the same, which has some process, creating standard tracefile "ora_<process_id>_orcl.trc".
    In case I run procedure from SQLPLUS, process_id was for example 3258 and trace file had name "ora_3259_orcl.trc". It seems that tracefile was created by some child process, called from sqlplus (having UNIX process_id 3258). But it means, that child's process_id could be bigger more than +1 (when more users works in the same time). And in case I run procedure from some Windows-oriented client on my PC, the <process_id> (obtained from V$SESSION as written above in procedure) had some nonsense value (for ex. 54823716) and tracefile I found under name "ora_3271_orcl.trc" - it seems that process, creating tracefile had normal UNIX-liked process_id 3271. From this issues questions:
    1. Is there some way to obtain in procedure process_id, which creates that standard tracefile?
    OR:
    2. Is there some way to obtain (in procedure) name of that tracefile ? (written into directory defined in USER_DUMP_DEST parameter)
    null

  • Substr function problem in oracle

    my requirement is that i am writing the stored procedure in which use
    *substr( source_string, start_position, [ length ] )*
    my 1 requirement
    i have i problem that the source_string is dynamically being passed as a parameter into the stored procedure
    means its length can vary
    and start_position is dynamically being passed as a parameter into the stored procedure should be that is should start from start of the sting and it can also vary
    my 2 requirement
    as in SQL Server we have left and Right function
    if we use left like this
    this is code from SQL Server
    note: in SQL Server left function Returns the left part of a character string with the specified number of characters.
    *@FinalCode = left(@TempCode,Len(@TempCode)-1)*
    *@FinalCode : this user declared local variable in stored procedure*
    *@TempCode:this is the dynamic string i am passing in stored procedure*
    when we use left it starts the reading string from left side
    note: in SQL Server right function Returns the right part of a character string with the specified number of characters.
    Set @FinalCode = Right(@FinalCode,len(@FinalCode)-1)
    when we use Right it starts the reading string from Right side
    my requirement is how to do this oracle as i am new to oracle 10g with the use of
    *substr( source_string, start_position, [ length ] )*
    Edited by: user21354 on Feb 8, 2011 4:06 AM

    when we use Right it starts the reading string from Right sideStart from left:
    SQL> select substr('abc', 1, 1) from dual;
    S
    aStart from right:
    SQL> select substr('abc', -1, 1) from dual;
    S
    c

  • What is the function of _xdb and _xpt services in oracle 10g database.

    what is the function of xdb and xpt services in oracle 10g database.?

    Hi,
    If you are troubleshooting check the below link too:
    Issues installing.  Listener not working
    Best regards,
    Rafi.
    http://rafioracledba.blogspot.com/

  • Convert substring function from SQL Server to Oracle

    I am converting a large application written for SQL Server to Oracle and have encountered a difference in how the substring function is called between the two database systems.
    In SQL Server:
    select substring('xyz'1,2)
    In Oracle:
    select substr('xyz',1,2)
    Is there a way to establish a user-defined operator to map the substring call to a substr call so I don't have to change the application code?
    Is the user-defined function a way to do this?
    Which is better?

    If you want to be able to use the code that has substring in it, without modifying it, and have it do the same thing as substr, then try running the script below. It will create a user-defined function named substring that will cause substring to act like substr.
    CREATE OR REPLACE FUNCTION substring
    (p_string IN VARCHAR2,
    p_start IN VARCHAR2,
    p_end IN VARCHAR2 DEFAULT NULL)
    RETURN VARCHAR2
    IS
    v_string VARCHAR2 (100);
    BEGIN
    IF p_end IS NULL
    THEN
    SELECT SUBSTR (p_string, p_start)
    INTO v_string
    FROM DUAL;
    ELSE
    SELECT SUBSTR (p_string, p_start, p_end)
    INTO v_string
    FROM DUAL;
    END IF;
    RETURN v_string;
    END substring;
    null

  • API (interface tables) to synchronize Oracle EBS and outsourced functions?

    Hi,
    Our company is outsourcing the inventory and shipping functions. Now we'll need to synchronize the Oracle EBS with actual shipment data. We have've to use the APIs and keep Oracle tables in sync with the legacy system.
    Which API we can use for Pick Confirm, when we have to do WMS and LPN handling? Or is there some other way (like interface tables) to take care of this issue?
    APIs should be supported with our EBS version 11.5.9. EBS version upgrade is not possible for us now. We'll need info how to implement above issue asap.
    BR Mervi Malmi

    Hi;
    All APIs are listed in Oracle Integration Repository
    http://irep.oracle.com/index.html
    API User Notes - HTML Format [ID 236937.1]
    R12.0.[3-4] : Oracle Install Base Api / Open Interface Setup Test [ID 427566.1]
    Oracle Trading Community Architecture API User Notes, June 2003 [ID 241320.1]
    Technical Uses of Customer Interface and TCA-API [ID 269121.1]
    Pelase also check below:
    Api's in EBS
    Re: Api's in EBS
    http://sairamgoudmalla.blogspot.com/2009/05/script-to-find-oracle-apis-for-any.html
    API
    Fixed Asset API
    List of API
    Re: List of APIs
    Oracle Common Application Components API Reference Guide
    download.oracle.com/docs/cd/B25284_01/current/acrobat/jta115api.pdf
    List of APIs and open interface R12
    Re: List of APIs and open interface R12
    Regard
    Helios

  • Are there different php functions for Oracle 8 and 9?

    Hi!
    Are there different php functions for Oracle 8 and 9?
    Thanks for your answer!

    You can use the oci8* functions for Oracle 8, 9 and 10.
    It is the most recent PHP interface to Oracle, and uses Oracle's most recent
    API.
    The name oci8 comes from the version number of Oracle - version 8 - when
    Oracle introduced a new C API. It succeeded the original OCI and got the
    common name OCI8. The original OCI now has the common name of OCI7.
    -- CJ

  • Analytical View - Substring function and Other functions.

    Hello All
    I am trying to use substring and trim function for a value/string and get the field value from position 6 - 10. in analytical view.
    Example: Field name XYZ (Values showing as: ASDFG GETVALUENW  2345) --> (data type :22 VARCHAR)
    Output must be : GETVALUENW (which is 10 characters, from position 6 after trimming) which I am wring to new filed in Calculated coloumns.
    Trying the use built-in functions but syntax wise missing some thing need your inputs.
    Regards
    Kiran.

    Hi Kiran Avunuri,
    A small thought process.
    Have you tried something similar(syntax) in your view.
    BR
    Prabhith

  • I love the 6th Gen. iPod Nano but it has a major deficiency, the power button. I've bought 2 and they both have given me the same issue of the power button becoming slack and not functioning. Why is this so, and how can I fix it??

    MAJOR DEFICIENCY = WASTED MONEY:
    I love the 6th Gen. iPod Nano but it has a major deficiency, the power button. I've bought 2 and they both have given me the same issue of the power button becoming slack and not functioning. Why is this so, and how can I fix it??

    Greetings,
    I've never seen this issue, and I handle many iPads, of all versions. WiFi issues are generally local to the WiFi router - they are not all of the same quality, range, immunity to interference, etc. You have distance, building construction, and the biggie - interference.
    At home, I use Apple routers, and have no issues with any of my WiFi enabled devices, computers, mobile devices, etc - even the lowly PeeCees. I have locations where I have Juniper Networks, as well as Aruba, and a few Netgears - all of them work as they should.
    The cheaper routers, Linksys, D-Link, Seimens home units, and many other no name devices have caused issues of various kinds, and even connectivity.
    I have no idea what Starbucks uses, but I always have a good connection, and I go there nearly every morning and get some work done, as well as play.
    You could try changing channels, 2.4 to 5 Gigs, changing locations of the router. I have had to do all of these at one time or another over the many years that I have been a Network Engineer.
    Good Luck - Cheers,
    M.

  • Functional difference between VISA resource name ASRL1::INSTR and COM1

    Config: LabVIEW 6.02, VISA 2.6.0
    I have used a text constant for "VISA Configure Serial Port.vi" for years, and just now I have run into problems.
    With my application, a text constant of ASRL2::INSTR would properly open the port, but it would not send any data, but using COM2 worked.
    What is the difference?

    MAX sets up serial port aliases automatically when possible. Let me try to explain.
    If the alias "COMx" was not previously configured in NI-VISA, and you have a serial port really named "COMx", and that VISA resource string does not have any other user-configured alias, then MAX will bind that alias to that port, regardless of what the full VISA resource string is. That part actually makes sense and shouldn't confuse anyone. If the alias "COMx" is taken, or the user has manually configured a different alias for the serial port (such as "MyDMM", for example), then MAX does not auto-assign the alias for that port. So far so good.
    The confusing part in many cases is how NI-VISA itself assigns the VISA resource string. For COM3, normall
    y NI-VISA would assign ASRL3::INSTR, and so on. There is 1 conflict that usually screws everything up. Since NI-VISA on Win32 allows you to open the parallel port by default as ASRL10::INSTR (for extremely historical reasons), the conflict occurs when you really have a COM10. It's not a terrible conflict, but it is confusing. NI-VISA will match every other port that it possibly can, and then just assign a unique resource name (ASRLx::INSTR) for COM10.
    I am not sure why in your case NI-VISA didn't match COM3 to ASRL3::INSTR. If you want to do some experimenting, try this. Go into MAX, delete all your VISA aliases, delete LPT1 from the tree, exit MAX, restart MAX, and refresh. See if that cleared it up.
    Dan Mondrik
    Senior Software Engineer, NI-VISA
    National Instruments

  • New Function in Oracle BI

    Hi :)
    I made a new function in PL/SQL transfering BLOB to CLOB.
    i made this function, because I know how to translate CLOB in Oracle BI.
    with this function for example:
    EVALUATE('DBMS_LOB.SUBSTR(%1,40,1)',PACKET_CONTENTS)
    but in my case, this Packet_content is BLOB, so i want to translate it to CLOB and than use the substr function to translate it (or part of it).
    so I tried doing that:
    EVALUATE('DBMS_LOB.SUBSTR(%1,40,1)',EVALUATE('BLOB_2_CLOB(%1)','111'))
    the parameter "111" is a param i give to my function (just for test). and my function should return the results from the PACKET_CONTENTS in CLOB type.
    the answer error i get is the following one:
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 14027] The navigator cannot handle the following request containing constants only: Evaluate( DBMS_LOB.SUBSTR(%1,40,1),Evaluate( BLOB_2_CLOB(%1),'111') ) as c1. (HY000)
    SQL Issued: SELECT EVALUATE('DBMS_LOB.SUBSTR(%1,40,1)',EVALUATE('BLOB_2_CLOB(%1)','111')) saw_0 FROM RWD ORDER BY saw_0
    Any ideas? or any other information you want to know?
    thanks :)
    P.S: im really new in the Oracle BI things, so I might be do silly things I cant do... so please fix me if you can :)
    thanks !

    Are you trying to return a text string from the BLOB/CLOB? Can you not do this in a database view over the top of your existing table, removing any potential ODBC/OCI issues?
    ie.
    CREATE VIEW test_view AS
    SELECT dbms_lob.substr( blob_column,4000,1) text_column
    FROM <table>;

Maybe you are looking for