Split string function in oracle ...

Hello,
Little question, is there any split string function available in Oracle.
SQL> select more_info
2 from dba_advisor_findings;
MORE_INFO
Allocated Space:4390912: Used Space:4237403: Reclaimable Space :153509:
select more_info as Allocated_Space,
more_info as Used_Space,
more_info as Reclaimable_Space
from dba_advisor_findings
Allocated_Space Used_Space Reclaimable_Space
4390912 4237403 153509
Thanks,
Manish Gupta

I explored more on SUBSTR and INSTR string functions ... and below is the solution
select substr(more_info,instr(more_info,':',1,1)+1,instr(more_info,':',1,2)-instr(more_info,':',1,1)-1) as "Allocated_Space",
substr(more_info,instr(more_info,':',1,3)+1,instr(more_info,':',1,4)-instr(more_info,':',1,3)-1) as "Used_Space",
substr(more_info,instr(more_info,':',1,5)+1,instr(more_info,':',1,6)-instr(more_info,':',1,5)-1) as "Reclaimable_Space"
from dba_advisor_findings;
Allocated_Space
Used_Space
Reclaimable_Space
4390912
4237403
153509
Thanks...

Similar Messages

  • String function in oracle plz help

    my input parameter is p1:=%01%01%01
    p2:= 5
    and my out put should like as below
    (%01%01%01nn)

    Or create function:
    create function url_encoded_rpad( p_str   in varchar2
                                     ,p_count in integer
                                     ,p_char  in varchar2)
    return varchar2 is
    begin
       return rpad( p_str
                       ,length(p_str)+p_count-length(regexp_replace(p_str,'%([0-9a-fA-F]{2})','X'))
                   ,p_char);
    end;Test:
    with t as (
              select '%01%01%01' a from dual union all
              select '%01a%01' a from dual union all
              select '%D1%D1%01' a from dual union all
              select 'abc' a from dual union all
              select '%01%02%03%04' a from dual union all
              select 'a%01%01%01' a from dual
    select a
          ,url_encoded_rpad(a,5,'n')
    from tRegards,
    Malakshinov Sayan

  • String function in Oracle 9i to find part of string having two positions

    Hi,
    We need to extract the part of string having start and end position.
    Like
    Suppose the string is "TYPE ref_cur_type IS REF CURSOR" and need to extract name of the ref cursor i.e ref_cur_type.The length of the output is not fixed. But not able to extract the exact string.
    Thanks,

    What is the criteria for part of string? Do you give start character and end character position like 3,9 etc? Or its just that the word that comes between two spaces?
    Cheers
    Sarma.

  • Function in oracle to find number of occurances of a character in a string

    hi,
    is there any function in oracle to find the number of ocurrances of a character in a string ?
    or is there any simple way of doing the same, rather than writting many lines of code as my program is already very complex.
    Maria

    Hi Maria,
    I don't know of such a function in Oracle, but maybe you could use this:
    length(search_string) - length(replace(search_string, character_to_be_found))
    For example: select length('Hello') - length ( replace('Hello', 'l')) from dual;
    Hope this is what you're looking for
    Danny

  • [OT] User-Defined string Functions  Oracle PL/SQL

    Ladies and Gentlemen,
    I am pleased to offer the following string functions Oracle PL/SQL:
    GETALLWORDS(): Inserts the words from a string into the table.
    GETWORDCOUNT(): Counts the words in a string.
    GETWORDNUM(): Returns a specified word from a string.
    OCCURS(): Returns the number of times a character expression occurs within another character expression (including overlaps).
    OCCURS2(): Returns the number of times a character expression occurs within another character expression (excluding overlaps).
    PADC(): Returns a string from an expression, padded with spaces or characters to a specified length on the both sides.
    STRTRAN(): Searches a character expression for occurrences of a second character expression, and then replaces each occurrence with a third character expression. Unlike a built-in function Replace, STRTRAN has three additional parameters.
    STRFILTER(): Removes all characters from a string except those specified.
    RAT(): Returns the numeric position of the last (rightmost) occurrence of a character string within another character string (including overlaps). The search performed by RAT() is case-sensitive. RAT similar to the PL/SQL function INSTR.
    ATC(): Returns the beginning numeric position of the first occurrence of a character expression within another character expression, counting from the leftmost character (including overlaps). The search performed by ATC() is case-insensitive. ATC similar to the PL/SQL function INSTR.
    RATC(): Returns the numeric position of the last (rightmost) occurrence of a character string within another character string (including overlaps). The search performed by RATC() is case-insensitive. RATC similar to the PL/SQL function INSTR.
    AT2(): Returns the beginning numeric position of the first occurrence of a character expression within another character expression, counting from the leftmost character (excluding overlaps). The search performed by AT2() is case-sensitive. AT2 similar to the PL/SQL function INSTR.
    REPLICATE(): Returns a character string that contains a specified character expression repeated a specified number of times.
    ROMANTOARAB(): Returns the number equivalent of a specified character Roman numeral expression (from I to MMMCMXCIX).
    Plus, there are versions for MS SQL SERVER, SYBASE ASA, DB2, MS SQL SERVER 2005 SQLCLR.
    More than 8000 people have already downloaded my functions. I hope you will find them useful as well.
    For more information about string UDFs Oracle PL/SQL please visit the
    http://www.universalthread.com/wconnect/wc.dll?LevelExtreme~2,54,33,29233
    Please, download the file
    http://www.universalthread.com/wconnect/wc.dll?LevelExtreme~2,2,29233
    With the best regards.

    >
    I am using the Oracle Data Provider in vs2012. I am having trouble calling a function that returns an object type defined.
    >
    Returning a collection like that is a bad idea to begin with. That isn't scaleable and wastes memory.
    Either return a REF CURSOR and let the client FETCH the rows or use a PIPELINED function and let the client query it like they would a table.
    Here is an example similar to yours that uses a PIPELINED function.
    create or replace
        package pkg2
          as
            CURSOR emp_cur is (SELECT empno, ename, job, mgr, deptno FROM emp);
            type pkg_emp_table_type is table of emp_cur%rowtype;
            function get_emp(
                             p_deptno number
              return pkg_emp_table_type
              pipelined;
      end;
    create or replace
        package body pkg2
          as
            function get_emp(
                             p_deptno number
              return pkg_emp_table_type
              pipelined
              is
              begin
                  for v_emp_rec in (SELECT empno, ename, job, mgr, deptno
                                    FROM emp where deptno = p_deptno) loop
                    pipe row(v_emp_rec);
                  end loop;
              end;
      end;
    select * from table(pkg2.get_emp(20));
           EMPNO ENAME      JOB              MGR     DEPTNO
            7369 DALLAS     CLERK2          7902         20
            7566 DALLAS     MANAGER         7839         20
            7788 DALLAS     ANALYST         7566         20
            7876 DALLAS     CLERK           7788         20
            7902 DALLAS     ANALYST         7566         20

  • Function module to split strings

    Hi,
    I have a string value ' DBTABLE-FIELDNAME'. I need to split this into 2 strings - The first one is the database table name and the second one is the fieldname. So, the character '-' is the point where the split needs to be done. How can this be achieved. Any FM that I could use?
    Thanks for your help!
    Regards,
    Divyaman Singh Rawat

    Use FM 'STRING_SPLIT'
    REPORT ZEXAMPLE.
    DATA: V_HEAD(10), V_TAIL(10).
    PARAMETERS: P_STR(20),
                P_DEM.
    CALL FUNCTION 'STRING_SPLIT'
         EXPORTING
              DELIMITER = P_DEM
              STRING    = P_STR
         IMPORTING
              HEAD      = V_HEAD
              TAIL      = V_TAIL
         EXCEPTIONS
              NOT_FOUND = 1
              NOT_VALID = 2
              TOO_LONG  = 3
              TOO_SMALL = 4
              OTHERS    = 5.
    IF SY-SUBRC EQ 0.
      WRITE:/ 'HEAD:', V_HEAD,
            / 'TAIL:', V_TAIL.
    ELSE.
      WRITE:/ 'ERROR SPLITTING STRING'.
    ENDIF.
    Regards,
    Joy.

  • Function in oracle

    If i pass the parameter like "select *from split('672','asdfg')"
    when i execute the function in sqlserver..
    it will give the following o/p:
    RowID value
    1     asdfg
    I want the same o/p in oracle using function....
    below i gave the sample function in sql server:
    alter FUNCTION [dbo].[Split]
    ( @Delimiter varchar(5),
    @List varchar(8000)
    RETURNS @TableOfValues table
    ( RowID smallint IDENTITY(1,1),
    [Value] varchar(50)
    AS
    BEGIN
    DECLARE @LenString int
    WHILE len( @List ) > 0
    BEGIN
    SELECT @LenString =
    (CASE charindex( @Delimiter, @List )
    WHEN 0 THEN len( @List )
    ELSE ( charindex( @Delimiter, @List ) -1 )
    END
    INSERT INTO @TableOfValues
    SELECT substring( @List, 1, @LenString )
    SELECT @List =
    (CASE ( len( @List ) - @LenString )
    WHEN 0 THEN ''
    ELSE right( @List, len( @List ) - @LenString - 1 )
    END
    END
    RETURN
    END
    execute: select *from split('672','asdfg')
    ----------------------------------------------

    user613197 wrote:
    If i pass the parameter like "select *from split('672','asdfg')"
    when i execute the function in sqlserver..
    it will give the following o/p:
    RowID value
    1     asdfgI'm not quite sure why you have "672" as a delimiter in a split function as that seems a very poor example, or maybe I'm just not understanding what your SQL Server split function is supposed to be doing.
    On Oracle, a simple split function that takes a string of delimited values and splits them up to generate seperate rows of data would be something like...
    SQL> CREATE OR REPLACE TYPE split_tbl IS TABLE OF VARCHAR2(32767);
      2  /
    Type created.
    SQL> CREATE OR REPLACE FUNCTION split (p_list VARCHAR2, p_delim VARCHAR2:=' ') RETURN SPLIT_TBL PIPELINED IS
      2      l_idx    PLS_INTEGER;
      3      l_list   VARCHAR2(32767) := p_list;
      4      l_value  VARCHAR2(32767);
      5    BEGIN
      6      LOOP
      7        l_idx := INSTR(l_list, p_delim);
      8        IF l_idx > 0 THEN
      9          PIPE ROW(SUBSTR(l_list, 1, l_idx-1));
    10          l_list := SUBSTR(l_list, l_idx+LENGTH(p_delim));
    11        ELSE
    12          PIPE ROW(l_list);
    13          EXIT;
    14        END IF;
    15      END LOOP;
    16      RETURN;
    17    END SPLIT;
    18  /
    Function created.
    SQL> SELECT column_value
      2  FROM TABLE(split('FRED,JIM,BOB,TED,MARK',','));
    COLUMN_VALUE
    FRED
    JIM
    BOB
    TED
    MARKor, simply in SQL alone you could do...
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select 'aaaa;;bbbb;cccc;dddd;eeee;ffff' as txt from dual)
      2  -- end of sample data
      3  select REGEXP_SUBSTR (txt, '[^;]+', 1, level)
      4  from t
      5* connect by level <= length(regexp_replace(txt,'[^;]*'))+1
    SQL> /
    REGEXP_SUBSTR(TXT,'[^;]+',1,LE
    aaaa
    bbbb
    cccc
    dddd
    eeee
    ffff
    7 rows selected.
    SQL>

  • HELP URGENT:; Splitting strings in servlets

    hi ...
    I am trying to access the below servlet from another servlet in iplanet . I have to access a file and arrange the '|' delimited data in the file in a table format like in html ...
    I have used my own function inside the servlets which splits a string based on character ...But I always get
    Internal error: exception thrown from the servlet service function (uri=/servlet/ReportsDataServlet): java.lang.NullPointerException, Stack: java.lang.NullPointerException
    at ReportsDataServlet.split(ReportsDataServlet.java:82)
    at ReportsDataServlet.doPost(ReportsDataServlet.java:56)
    at ReportsDataServlet.doGet(ReportsDataServlet.java:14)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.iplanet.server.http.servlet.NSServletRunner.invokeServletService(NSServletRunner.java:919)
    at com.iplanet.server.http.servlet.NSServletRunner.Service(NSServletRunner.java:483)
    The sample code is shown below....I get the same error when i tries with stringokenizer as well....Pls help me fix this.....
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, Se
    rvletException
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    cont=getServletContext();
    out.println("<html><head><title>Reports Data</title></head><body bgcolor=DBD0E2>");
    String repType = request.getParameter("Rep");
    String mon = request.getParameter("month");
    String day = request.getParameter("day");
    String year = request.getParameter("year");
    String repName = repType+"."+mon+"-"+day+"-"+year+".txt";
    BufferedReader in = new BufferedReader( new FileReader("/home/lnayar/baais/xmlServlet/"+rep
    Name));
    String st;
    st = in.readLine();
    cont.log(st);
    int c =0;
    out.println("<table border=\"3\" cellpadding=\"0\" cellspacing=\"0\" width=\"800\"><tr><td>L
    ATA</td><td>WC CLLI</td><td>WC NAME</td><td>ADSL_LOCATION</td><td>ATM FLAG</td><td>ATM RELIEF DATE</td><t
    d>FRAME FLAG</td><td>FRAME RELIEF DATE</td><td>GOLD FLAG</td><td>GOLD RELIEF DATE</td><td>OVERLAY INDICAT
    OR</td><td>COUNT</td></tr>");
    while (st != null)
    c++;
    st = in.readLine();
    StringTokenizer stt = new StringTokenizer(st);
    out.println("<tr>");
    while (stt.hasMoreTokens())
    //out.println("<td>"+stt.nextToken("|")+"</td>");
    out.println("<td>hello</td>");
    out.println("</tr>");
    while (st != null)
    c++;
    st = in.readLine();
    out.println("<tr>");
    Enumeration en = split(st,"|");
    while(en.hasMoreElements())
    out.println("<td>"+en.nextElement()+"</td>");
    out.println("</tr>");
    cont.log("out while");
    out.println("</table>");
    out.println("</body></html>");
    public Enumeration split (String str, String delim)
    Vector v = new Vector();
    int pos_1;
    int pos_2;
    //Set initial delimiter positions...
    pos_1 = 0;
    pos_2 = 0;
    //Start chopping off bits from the string
    //until left boundary reaches the length of string
    while ( pos_1 <= str.length() )
    pos_2 = str.indexOf(delim, pos_1);
    if ( pos_2 < 0 )
    pos_2 = str.length();
    String sub = str.substring (pos_1, pos_2);
    pos_1 = pos_2 + 1;
    v.addElement(sub);
    return v.elements();
    d deeply appreciate if soeone could take a look at the code and tell me exactly where i am going wrong ..... Its URGENT ...
    Thx
    klv

    But there is the while statement which filters null
    values..Which is useless in your case, because you proceed to change the value of st to something else which you don't check for null.
    At any rate, what you have to do is this:
    1. Look at the stack trace to find the line number where the error occurs.
    2. Look at that line in your code.
    3. Look at each object variable in that line. Find out how it became null and fix that.

  • Import Functionality in Oracle ADF BC with Jdeveloper 11.1.1.2

    Hi all,
    I am using Jdeveloper 11.1.1.2 and I am trying to import functionality in my application.
    I am following the steps of: http://andrejusb.blogspot.com/2008/07/import-functionality-in-oracle-adf-bc.html
    I have 2 data model and I would like to import the functionality of one data model, in the other.
    My problem is when I tried: myModel2-->right click-->project properties-->deployment-->edit
    I don't see nothing to filter myModel2, I see only Library Dependencies, Connections, JAR Options ADF Validation.
    If I tried : myModel2-->right click-->project properties-->deployment-->new-->filters
    I see only the folders: Merged Contents of this file Group's contributor, .data, 00000000
    But I can't see the folders I have (mypackage.test.model.entities).
    Where I can found them? Is there a workaround?
    Any suggestions?
    Thanks
    Andrea

    Ok, but I taught that after importing myModel2 in myModel1, Jdeveloper realise a merge and it visualizes a unique package, even if it is splitted on two or more projects/models.
    So that, it seems to me this procedure is useful for importing jar file, but not for splitting a very big project in a lot of smaller projects, doesn't it?
    Thanks for your opinion
    Andrea

  • How to call java function in Oracle forms?

    Hi I am having Oracle 9i with 10g Developer Suite.
    I am new to Oracle forms..
    I had one function in java getDatas()..
    How can I call this function in Oracle Forms..
    Pls help
    Thanks

    Thanks Francois,
    I want to display values from my java code in the Forms..
    For that purpose only i am installing 10g Developer Suite..
    The below is java code..
    public class DBTest {
              public static String callDB(int id,String name){
              String ss="Hai";
              Connection con=null;
              try{
                   Class.forName("oracle.jdbc.driver.OracleDriver");
                   con = DriverManager.getConnection("url","id","pwd");
                   Statement st=con.createStatement();
                   System.out.println("Connected...");
              int r=st.executeUpdate("Insert into FORM_TEST VALUES('"+id+"','"+name+"')");
                   if(r==1){
                        ss="Inserted Sucessfully";
                   else{
                        ss="Insertion Failed";
              }catch(final Exception e){
              System.out.println(e);
              return ss;
         public static void main(String[] args) {
              int empid=102;
              String empname="Gilbert";
              String resultStr=callDB(empid,empname);
              System.out.println(resultStr);
    I want to dispaly Inserted or Insertion Failed in Oracle Forms..
    As per Gerd Volberg suggestion, i had placed DBTest.jar in
    E:\DevSuite\forms\java\DBTest.jar
    and in formsweb.cfg the below jar is added..
    archive_jini=frmall_jinit.jar,DBTest.jar
    But in Fomrs Builder-->Program-->Import Java Classes-->Oracle
    org,ice,com and subnodes are available.
    But my jar is not available..
    Is my way is coorect?
    Pls provide soln..
    Thanks

  • Numeric functions in Oracle Text

    Hi
    Do we have numeric functions in Oracle Text, if not what we have to do for filtering/searching numeric fields
    Thanx
    Hari

    there are no numeric functions. You search numeric information by exact string match.

  • Converting the iif function in MS Access97 to an user defined function in Oracle

    Hi ,
    I have a problem here we are working with Visual Basic 6.0(ADOs 2.5) with Oracle 8i release 2. we have some queries stored in the tables which contains the iif function of MS Access 97 do we have a similar built in function in Oracle which replaces this iif function of Ms Access 97.
    we cannot use decode (built in function) of oracle b'cos it cannot be used in a where clause and we cannot write a user defined function also because it cannot be generalized for use b'cos sometimes we use
    field names and sometimes values as expression in the iif functions
    If anybody could suggest me some idea
    please mail me at [email protected]
    with best regards
    Jai

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Jai:
    Hi ,
    I have a problem here we are working with Visual Basic 6.0(ADOs 2.5) with
    Oracle 8i release 2. we have some queries stored in the tables which contains the iif function of MS Access 97 do we have a similar built in function in Oracle which replaces this iif function of Ms Access 97.we cannot use DECODE (built in function) of oracle b'cos it cannot be used in a where clause and we cannot write a user defined function also because it cannot be generalized for use b'cos sometimes we use field names and
    sometimes string values as expression in the iif functions. is there any other built in function ? can anybody suggest me some idea
    please mail me at [email protected]
    regards
    Jai<HR></BLOCKQUOTE>
    Hi,
    You still can use the seccond approach - with a udf IIF() that you place in a package and OVERLOAD it. See the documentation for limitations of Overloading
    Overloading permits you to declare several functions with the same name but havind different behaviours depending on the number and type of the parameters.
    George

  • Error calling function in Oracle

    Hi All,
    I am calling the function in Oracle the following way
    cs = conn.prepareCall( "{? = CALL package_name.function_name(?)}" );
    But on the above line in my code, I am getting the error
    java.sql.SQLException: Malformed SQL92 string at position: 5. Expecting "call"
    Did anybody run into same issue?
    Thanks

    Until something slicker comes up:
    try {
    String sql = "select RISK.HVAR_MAINT.FNV_GET_PARTITION_NAME(?,'04-mar-2003') as theValue from dual ";
    // Connection conn = getConnection();
    CallableStatement stmnt = conn.theConnection.prepareCall(sql);
    stmnt.setString(1,"hvar_mtm") ;
    stmnt.execute();
    ResultSet rs = stmnt.getResultSet() ;
    while ( rs.next() ) System.out.println(rs.getString("theValue") ) ;
    rs.close() ;
    } catch (Exception e) {
    System.out.println(e.getMessage() ) ;
    Note: I have not been able to get "CALL" to work in Oracle
    May be the next guy cal get conn.prepareCall( "{? = CALL package_name.function_name(?)}" ); to work

  • Table-Valued function in oracle

    Hi All,
    I have a table-valued function in MS SQL Server, that I want to convert it.
    How can I create table-valued function in Oracle 9.2.0.1.0
    Thanks for your thoughts

    Just so we are talking the same language, array-type constructs in Oracle are generally known as "collections", while "table" generally refers to a database table. Having said that, you may see references to "PL/SQL Tables" which was the old name for collections when they first came out, although this term has been mostly withdrawn as it's somewhat misleading and causes confusion (that's marketing for you).
    Now I think about it we also have table functions, the official name for functions that return collections although IMO almost as misleading. Anyway my rambling point is that "function that returns a table" may cause confusion in Oracle circles. Or maybe it's just me.
    There are loads of String To Table examples around:
    * www.williamrobertson.net/documents/comma-separated.html
    * www.oracle-developer.net/display.php?id=412
    Couldn't you have the procedure accept an array in the first place and have something else do the string conversion before it reaches the procedure?
    Edited by: William Robertson on Aug 29, 2008 5:39 PM

  • Using PI - Calling a Function in Oracle

    Hi,
    I understand that the receiver JDBC adapter is capable of calling a stored procedure or a function in Oracle.  I would like to call an Oracle function using the Receiver JDBC Adapter.  How should my structure look like.
    Thanks.
    Krishnan

    Hi,
    I have created a structure like:-
    <STATEMENT>
    <FUNCTION action="EXECUTE">
    <FunctionName>myFunction</FunctionName>
    <SerialNo type="NUMERIC">1000001</record_count>
    <SerialDate hasQuot="NO" type="STRING">TO_DATE(&apos;07-10-2008 04:59:43&apos;,&apos;MM-DD-YYYY HH24:MI:SS&apos;)</SerialDate>
    </FUNCTION>
    </STATEMENT>
    I am getting the following error in the JDBC receiver adapter:-
    com.sap.engine.interfaces.messaging.api.exception.MessagingException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'myFunction' (structure 'STATEMENT'): java.sql.SQLException: ORA-06550: line 1, column 7: PLS-00221: 'myFunction' is not a procedure or is undefined ORA-06550: line 1, column 7: PL/SQL: Statement ignored
    Thanks.
    Krishnan

Maybe you are looking for

  • Error while deploying new RPD in obiee 11g

    Hi , Getting the below error , while activating changes , after deploying a new RPD through EM : Message SEVERE: Element Type: JEE_SERVER, Element Id: 01HW447397:bi_server1, Operation Result: UNEXPECTED_ERROR, Detail Message: Exception occured during

  • IPAD video files not transferring to hardrive

    Hi there. I've filmed just a few minutes over an hour of video on my Ipad, and i tried putting it onto an external hardrive which definitely has enough space on for the videos (it has over 450GB free, and my videos are only 7GB each) yet it still tel

  • Changing apps backgrounds and text colors

    I am legally blind using iPod touch with upgraded iPhone software to use the apps store. It hard to read black text with white background on email app and the apps store app is impossible to see and with no way to enlarege screen on that app and many

  • Album 1.0

    I have a backup of photoshop album 1.0 on an external drive. How do I download to elements 12.0?

  • Organizer and network storage - everything is offline

    Have been using PSE 7 for quite some time. Over time, I have moved all my photos over to a NAS unit, but lately the photos turned up as offline in the Organizer. I took the opportunity to upgrade to PSE 9, started with a brand new project, and tried