Substr Function Issue

Hello,
I have a following query
Select '||' || RW."Description" || ':' || RW."Reason_Code"
from TMTABLE UL, XMLTABLE('//Row' PASSING UL.TEXT
COLUMNS
"Event" CHAR(10) PATH 'Event',
"Reason_Code" PATH 'Reason_Code',
"Description" PATH 'Description'
) AS RW
WHERE
UL.ID = '[Param.1]' and
UL.QUEUENAME = '[Param.2]' and
RW."Event" = '[Param.3]'
which returns me following result set
||A:00052
||B:00053
||C:00054
||D:00055
||E:00056
But I want all these rows to be concatenated like this : A:00052||B:00053||C:00054||D:00055||E:00056
So I had written following query:
Select substr( (Select '||' || RW."Description" || ':' || RW."Reason_Code"
from TMTABLEUL, XMLTABLE('//Row' PASSING UL.TEXT
COLUMNS
"Event" CHAR(10) PATH 'Event',
"Reason_Code" PATH 'Reason_Code',
"Description" PATH 'Description'
) AS RW
WHERE
UL.ID = '[Param.1]' and
UL.QUEUENAME = '[Param.2]' and
RW."Event" = '[Param.3]' ) , 3 , 2000 ) from Dual
But it gives this error: java.sql.SQLException: ORA-01427: single-row subquery returns more than one row
what should I do to achieve desired result?

Russ,
Thanks for having a look, I think we've got a bit confused. 'Max char fetched' is the item property, you can see in Admin - Disco reserves this space for the column whilst running the query .
Yes, unfortunately we are having to substr all function calls in DB views as Disco defaults to 2000/4000 chars for these items - have a look at some of the standard BIS BAs or see Metalink Note:270273.1 for info. This we can live with and its fixed in 10g...(uuughhh I hate 4i after having done a few 10g implementations). Then we'll remove them after upgrade to help the CPU cause, but it could be many months away.
The current problem that I'm finding strange, is the tripling issue. If a DB view has and item say SUBSTR(emps.employee_longname,1,150) - no function calls involved, this then appears in the folder with the item property 'Max char fetched' as 450 - I would have thought that this should be 150.
In all the years of working with Disco, I never noticed this behaviour before - though I have never looked at it before. I thought I'd give the forum a try b4 raising a SR to see if somebody has encountered this.
thanks,
matt

Similar Messages

  • @SUBSTRING function issue

    Hi,
    I try to put a formula on a member in Hyperion Planning :
    *@MEMBER(@SUBSTRING(@NAME(@CURRMBR(Measures)),0,5)) -> @MEMBER(@SUBSTRING(@NAME(@CURRMBR(Measures)),7));*
    For example, on the member "205000_DIM", this formula has to return the data on "205000"->"DIM".
    But I've got an error message in Essbase : +Error executing formula for [205000_DIM] (line 1): attempt to cross a null member in function [@X]+
    When I put "205000"->@MEMBER(@SUBSTRING(@NAME(@CURRMBR(Measures)),7)); => it works !!!!
    I do not understand...
    Please help !
    Thanks a lot.
    Virgile.

    Oups !
    I'm dreaming... I thought I tried that...
    In Oracle Techical Reference documentation, they say 0 is the first character... So, for me, the sixth character corresponds to 5 in the formula...
    But I guess I'm wrong.
    Thank you !!
    Virgile.

  • Substring Function is not working

    Hi All
    I am using substring function like below
    SUBSTRING("Year"."Quarter" FROM 3 FOR 7) and its working,
    but when I add any computed column like aany measure column from fact then it will show the error.
    My datasoyrce is Essbse
    Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
    +State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 42043] An external aggregate is found in an outer query block. (HY000)+
    SQL Issued: SELECT SUBSTRING("Year"."Quarter" FROM 3 FOR 7) saw_0, Market.State saw_1, CCoA.Assets saw_2 FROM localhost ORDER BY saw_0, saw_1_
    Thanks to all for reply for previous questions
    Hitesh
    Edited by: user13805575 on Feb 24, 2011 10:47 AM

    Hi,
    try this.
    SUBSTRING(cast(measure as char) FROM 3 FOR 7)Please ignore........

  • Invalid length parameter passed to the LEFT or SUBSTRING function, error on INSERT

    I have a stored procedure that does a BULK INSERT of a csv file into myCSVTable then INSERTs records from
    myCSVTable into myTable. The INSERT statement is giving me this error: 
    Invalid length parameter passed to the LEFT or SUBSTRING function.
    CSV File: 
    3,020000007,OR,051,97205,02020005,41075,19470721,2,0,,0,0,0,0,0,1,0,0,,,,,,,,,0,2,,334418,334418,334418,13,,0,,0,0,0,0,0,1,0,0,1,20100217,,,,,20100304,20121030,1,1,,,0,0,0,0,0,,,,,0,0,0,0,9,0,0,0,1,1,0,0,0,3,00,20100304,20100426,20100922,20101011,20100304,20100922,20101011,,20101011,20100819,,20100326,20100326,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,0,,,1,1,,9,9,1,1,1,1,0,0,111150,111150,111150,999999,5586.25,4714.01,5884.28,7055.89,11097.89,10839.39,0.00,2,,,,,20120617,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,The
    Workforce Investment Board for the City of xxxxxxxx and xxxxxxxxx and W,020005,,mstr: 1000000000000000017  js: 372651          epi: 1,Jane Doe
    4,020000007,OR,051,97205,02020005,41075,19470721,2,0,,0,0,0,0,0,1,0,0,,,,,,,,,0,2,,334418,334418,334418,13,,0,,0,0,0,0,0,1,0,0,1,20100217,,,,,20100304,20121030,1,1,,,0,0,0,0,0,,,,,0,0,0,0,9,0,0,0,1,1,0,0,0,3,00,20100304,20100426,20100922,20101011,20100304,20100922,20101011,,20101011,20100819,,20100326,20100326,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,0,,,1,1,,9,9,1,1,1,1,0,0,111150,111150,111150,999999,5586.25,4714.01,5884.28,7055.89,11097.89,10839.39,0.00,2,,,,,20120617,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,The
    Workforce Investment Board for the City of xxxxxxxx and xxxxxxxxx and W,020005,,mstr: 1000000000000000017  id: 020000007       epi: 1,Jane Doe
    There is no LEFT or SUBSTRING function used in the procedure and there are no triggers on either table. 
    The procedure had been working fine until today, when I altered one of the CSV fields. The code which triggers the error is this:
    INSERT [myTable]
    SELECT * FROM [myCSVTable]
    The weird thing is, the 1st record containing the changed field (mstr: 1000000000000000017  js: 372651          epi: 1) triggers the error, but the 2nd record containing
    the old field value (mstr: 1000000000000000017  id: 020000007       epi: 1), does not. 
    There are only blank spaces in the 2 strings, no non-printable characters or anything like that. I'm confused.

    A View of myTable was causing the problem.
    Hi LoriCazares,
    Do you mean that you have solved this issue? If so, please close this thread.
    Regards,
    Elvis Long
    TechNet Community Support

  • 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

  • Use of substr function will avoid the use of indexes in a table

    i have one table which will contain some 3,00,000 records, it contains some 11 primary keys i am using some update statements to update some fields in the records (of 3,00,000 i will compare some 1,50,000 records with 1,50,000 another records) i am using substr function in all the select statements. whether usage of substr function will avoid the use of index
    can any one clarify?

    contains some 11 primary keys by this I suppose you mean to say the table has a composite PK on 11 columns.
    i am using substr function in all the select statementsCould you please post your SQL statement?

  • Function issue of Cross-Reference

    Hi,
    thanks for your attention on this topic.
    there is function issue of Cross-Reference.
    when click the Cross-Reference after re-installed the software (adobe Framemaker 7.10), the function is not working. please kindly check the screenshots below:
    Error message below:
    Please help to check this issue.
    software: Adobe Framemaker 7.10
    System: windows xp sp3
    thanks in advance for your support .
    Message was edited by: Lu Steven

    Fire the error log off to the e-mail address indicated in the error message and then contact Adobe Support.

  • Using substring function in the Universe

    What is the correct syntax of using the substring function in the Universe?
    I need to extract the numbers and decimal between the #'s, and the character length varies:
    From: DOE, JOHN  Added the following entry to work history:
    A1S#0.25#
    To: 0.25
    Please help!  Thanks!

    There are ticket details in the text - I replaced certain letters with x, o, or a.  I thought you would need the total number of characters in the text.
    0.25#"
    DOE, JOHN A Xddxd xxx xxllxwOIg xIxxI xx wxxk xOXxxxI:
    A1S#0.25#"O xxxxd Oxck xxxm CJ, xx XxOd xxxx wx xxx XuppxXxd xx Ox gxxxOIg xlxxxX xI xxOX.  Xx, xxx quxXxOxI xxmxOIX wxxx xx dx Ixw?  XOxxxx wx mxkx xxx dxcOXOxI xx OgIxxx xxOX cxIdOxOxI xId xxvx Ox xxmxvxd xxxm XmxxxX, xx wx xxI xx xxXxxxcx xxp xxlkxxX xId Xxx Ox wx cxI Xxxp Xxmx xx xxx xxxxxOc, xx wx xxdxx x OOggxx cOxcuOx xx xxIdlx xxx OuxXxX wOxxxux xII dxxpX.  O'll xxI xx xuI xxOX OI mxIxgxmxIx xId xxx xxXx xx xxx xxxm xx Xxx wxOcx wxI wx wxIx xx gx".
    1#"
    DXX, JXXN X XddXd xxX xxllxAxng XnxrN xx Axrk xxAxxrN:
    A1S#1#"X dxn'x AXX xxxA xn AxnAxrd.  X AxA gxxng xx AxXAk xxX xnxXrxxAX xx AXX xx ApxkXA xn xxrxugxpux AXrX xbAXrvXd xA xxA bXXn AuggXAxXd, xxAXvXr, xxA nxx xn AxnAxrd.  X AxXAkXd Dxrx xnd dxn'x AXX xnN xndxAxxxxn xxxx xxxA xA xn xnN xlxrI grxupA xxr xxrXAxxld Ixnxxxrxng, Ax X'I AxndXrxng AxXrX xxX xlxrI xA AxIxng xrxI.  Xx Axuld bX xxxx xxXrX xA nx xnxXnxxxn xx bX xlxrIxng xn xxxA xx xll xnd xxX xlxrIA Axuld bX AxIxng xrxI xn xld Ixnxxxrxng AxurAX xxxx xA nx lxngXr vxlxd (xX, xxxA AlxppXd xxrxugx xxX ArxAkA AxIXxxA).  X AXnx xn XIxxl xx AurxxA JxnXA xx AXX xx xX Axn xXll Axxx xxX AxurAX xx xxX xlxrI xA (xX, Axxx Ixnxxxrxng ANAxXI xAxuxllN gXnXrxxXd xxX xlxrI)."
    0.5#
    DOE, JOHN A Xaaxa xax OolloxixI xxxIx xo xoIk aisxoIx:
    A1S#.05# "XIxxsOxIIixI xo IXS XixI x quxux OoI xaaixioxxl ixOoIoxxiox xxa Ixcoooaxxioxs."

  • SUBSTR function in the where clause

    HI
    I want to get a number of 15 digits from a column where the user only know the last 10 digits.
    So that when the user enter a number with 10 digits, only the record of that specific number should be displayed.
    And then when the user did not enter any number all the records in the table should be displayed.(this part works fine)
    The problem is: when the user enters any last digits( last, second last, thirth last and so on) the records which satisfy this are retrieved, which is not supose to be the case.
    I' am trying to use the substr function in the where clause but I'm not sure if it's working or not becasue the result of the query is just the same as before i used the substr.
    Thanks

    better to pad with '*' me thinks in case u have a number ending with 0's:
      1  select empno,ename
      2  from emp
      3* where empno like '%'||lpad('&1',2,'*')
    SQL> /
    Enter value for 1: 0
    old   3: where empno like '%'||lpad('&1',2,'*')
    new   3: where empno like '%'||lpad('0',2,'*')
    no rows selected
    SQL> /
    Enter value for 1: 00
    old   3: where empno like '%'||lpad('&1',2,'*')
    new   3: where empno like '%'||lpad('00',2,'*')
         EMPNO ENAME
          7900 JAMES
    SQL> /
    Enter value for 1:
    old   3: where empno like '%'||lpad('&1',2,'*')
    new   3: where empno like '%'||lpad('',2,'*')
         EMPNO ENAME
          7369 SMITH
          7499 ALLEN
          7521 WARD
          7566 JONES
          7654 MARTIN
          7698 BLAKE
          7782 CLARK
          7788 SCOTT
          7839 KING
          7844 TURNER
          7876 ADAMS
         EMPNO ENAME
          7900 JAMES
          7902 FORD
          7934 MILLER
    14 rows selected.

  • Substr function? extracting just the records with 4 digits?

    have a column like this in a table
    SZSCAPD_SEC_SCHOOL_CEEB
    364775
    460460
    460240
    2562
    164625
    460240
    230969I need to be able to retrieve just the values with 4 digits like 2562 and add 00 at the front, so it will ended like 002562
    I am thinking in the substr function, but it won't work, because I will be extracting the first 4 digits of each number.
    How I will do this? I want to only retrieve the numbers with 4 digits Then I will concatenate the 00 in front.
    Thank you

    Hi,
    peace4all wrote:
    ... How I will do this? I want to only retrieve the numbers with 4 digits One way to do that is
    WHERE   TRANSLATE ( szscapd_sec_school_ceeb
                , '123456789'
                , '000000000'
                ) = '0000'
    Then I will concatenate the 00 in front.
    '00' || szscapd_sec_school_ceebThis assumes that szscapd_sec_school_ceeb is a string.
    If szscapd_sec_school_ceeb is a positive number, and you want to ignore any fractional part, use
    WHERE   szscapd_sec_school_ceeb     >=  1000
    AND     szscapd_sec_school_ceeb <  10000to find the numbers and
    TO_CHAR (szscapd_sec_school_ceeb, 'FM000000')to display them as 6 digits, with leading 0's.
    Edited by: Frank Kulash on Aug 20, 2010 11:01 AM
    Added NUMBER alternative.

  • Substring function not working in Analytical view

    Dear All,
    I am trying to use substring function in my analytical view .It says valid expression during syntax check but getting activation error.
    thanks
    Sourav

    Hi Krishna,
    This is Kiran, I am trying to restrict a (string) filed value by removing the spaces and wring to calculated column field in an Analytical view for position 6 - 10.
    Example: Field name XYZ (Values showing as: ASDFG GETVALUENW  2345) --> (data type :22 VARCHAR)
    Output Value must be : GETVALUENW (which is 10 characters, from position 6 after trimming)
    Please advice which function use and how to apply the syntax
    Your inputs are highly appreciated.
    Thanks
    Kiran.

  • Substring Function without the length!

    I know I have seen this before, but cannot find it when searching.
    I need to do something similar to the Substring function, where I start from position 4, but the length behind this position is variable.   Due to the IDOC it only passes the value...
    I think I possibly saw a UDF for this somewhere - unless I can use some standard mapping!
    It is probably very simple - but it is late in the day and my eyes are square!  = )
    <i> I need a drink......</i>
    Can anyone help?
    Message was edited by:
            Barry Neaves

    For substring function, you have 1 input and 2 parameters (you set the parameters by double-clicking the function box).
    I also didn't understand how you can pass the output of length function two 2nd parameter of substring function (since it is a parameter and not an expected input).
    You could always create a UDF...
    public String UDSubstring(String a,String b,String c,Container container){
      int d = Integer.parseInt(b);
      int e = Integer.parseInt(c);
      if ((e == 0) && (a.length() >= d)) {
        return a.substring(d);
      else if ((e > d) && (a.length() >= e)) {
        return a.substring(d, e);
      else return "";
    They don't bite, you know...
    Regards,
    Henrique.
    <b>Edit:</b> followed by Michal's correction...

  • Substring function in HFR

    Hello Experts,
    Iam a rookie in HFR. I needed to know how to implement the Substring functionality in Hyperion. Can anyone throw some light on this?

    thats a major drawback of hyperion financial reporting of not having any string functions. as per my knowledge there is none.
    Let me know if you get to know of the same. Coz even I need it for couple of things in my reports.
    regards,
    rahul

  • Substring Function in formula builder of transfer rule

    Hi Gurus
    I want to get the domain name from Email address.
    For eg: if the email address is [email protected], i want to display only "yahoo.com" in the report.
    For that, shall i use Substring function in transfer rule.
    If so, please advice me how i can do this.
    Thanks
    Sansen

    Instead try using a routine using the SPLIT function...
    For example if you want to split the value of the field TEST whose value is [email protected] then try writing a code like below in the transfer routine...
    DATA: TEST1(30), TEST2(30) TYPE C.
    SPLIT TRAN_STRUCTURE-ZEMAILID AT '@' into TEST1 and TEST2.
    RESULT = TEST2.
    (value of TEST2 would be yahoo.com)
    Hope this helps...

  • Using substring function with error

    Hi Guys,
    I have a source field with 1200 characters which need to map to multiple target segments for  132 count of this source field.
    This is not a mandatory field so it sometimes come without any value.
    I am using substring function to breakout the string for every 132 characters and mapped to the target segments.
    There are two problems, first it seems that if source is blank, there will be error.
    Second, if source field come with only eg. 300 characters, error will also occurs.
    I have searched thru SDN and try some of the UDF but to no avail.
    Appreciate your guidance on this problem.
    Regards
    FNG

    H Rahul,
    I have tried your quote but face some syntax error as follows
    Function calculate, Line 6:
    cannot find symbol symbol  : method length() location: class java.lang.String[] j = input.length();       
    Function calculate, Line 26:
    cannot find symbol symbol  : method subString(int,int) location: class java.lang.String[]           
    result.addValue(input.subString(0,EndIndex));                                      ^
    Function calculate, Line 34:
    cannot find symbol symbol  : method subString(int,int) location: class java.lang.String[]                result.addValue(input.subString(StartIndex,EndIndex));                                              ^
    Function calculate, Line 40:
    cannot find symbol symbol  : method subString(int,int) location: class java.lang.String[]                result.addValue(input.subString(StartIndex,EndIndex));                                              ^ Note: /usr/sap/D03/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Mapd66a3a60002911e09ba9e41f132d6b68/source/com/sap/xi/tf/_MM_MT_COMS_TO_ZME_CRE_CHG_CONTRACT_.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: /usr/sap/D03/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Mapd66a3a60002911e09ba9e41f132d6b68/source/com/sap/xi/tf/_MM_MT_COMS_TO_ZME_CRE_CHG_CONTRACT_.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 4 errors

Maybe you are looking for

  • Remote for iTunes on a networked XP desktop

    I have not been able to get the Remote app for iphone to connect to my large iTunes app on my Windows XP desktop. When I launch it on the iphone in my home, it immediatly finds my son's XP laptop, which is connected to the same network that the iphon

  • Is it possible to install CS5 or CS5.5 on a 2.4 GHz Intel Core 2 Duo 4 GB 667 Mhz DDR2 SDRAM MacBook Pro running 10.6 (Snow Leopard)?

    Is it possible to install CS5 or CS5.5 on a 2.4 GHz Intel Core 2 Duo 4 GB 667 Mhz DDR2 SDRAM MacBook Pro running 10.6 (Snow Leopard)?

  • How to use CRM_COPY_BADI

    Hi Experts, My Requirement is to create Service Order Contract Quotations with the creation date as Service Contract End date + 1 that mean Service Order Contract Quotations( Creation Date ) = Service Contract (End date + 1). So i am using CRM_COPY_B

  • SPAM short dumps in CHECK_REQUIREMENTS phase

    Hi All, I am importing support packages SAPKE60028 - 35 (SAP_HR) and SAPKGPHD28 - 35 (EA-HR) into my ECC 6.00 DEV system.  When the process moves to the CHECK_REQUIREMENTS phase, I get a short dump as shown: The current ABAP program "SAPLSPAM" had to

  • Error using Wi-Fi

    Well, i am using wi-fi and sometimes it get disconected. It disconect and try to found new networks. Then, i select my network again and it asks me the password. I put the password and it works again. It happened to me sometimes, the wi-fi disconect