Pivoting and string manipulation

Hi Guys I would appreciate your help with this.
I have a table with a single column= A1, A2, B1, C1, C2 which I need to pivot and write the following rows to a second table again as a single column;
A1,B1,C1
A1,B1,C2
A2,B1,C1
A2,B1,C2
An example would be great. Thanks in advance.
Gaz

Hi,
Gaz wrote:
... Hope this covers all your questionsNo.
Frank Kulash wrote:
... Explain the business rules as clearly as you can. Why don't you want rows like the following in the second table:
C1, B1, A1
B1, B1, B1
A1, A2, B1or do you?
Do you know, in advance, that the strings all start with 'A', 'B' or 'C', or does the query have to figure out what the different possibilites are?I made several guesses.
INSERT INTO     target_tab (col1)
WITH  normalized_source_tab     AS
     SELECT     REGEXP_SUBSTR ( col1
                            , '[^ ,]+'
                     , 1
                     , LEVEL
                     )          AS txt
     ,     DENSE_RANK () OVER ( ORDER BY  REGEXP_SUBSTR ( col1
                                                                 , '[^ ,0-9]+'
                                              , 1
                                              , LEVEL
                             )          AS prefix_num
     FROM     source_tab
     CONNECT BY     LEVEL <= 1 + LENGTH (col1)
                             - LENGTH (REPLACE (col1, ','))
SELECT     SUBSTR ( SYS_CONNECT_BY_PATH (txt, ', ')
            , 3
FROM     normalized_source_tab
WHERE     CONNECT_BY_ISLEAF     = 1
START WITH     prefix_num     = 1
CONNECT BY     prefix_num     = 1 + PRIOR prefix_num     
;Among other things, I guessed that the comma-delimited items in sorce_tab.col1 always follow this pattern:
(1) Optional spaces, to be ignored
(2) Non-digits, which deterrmine the postion in target_tab.col1
(3) Digits
Either (2) or (3), but not both, may be omitted. If both are present, (3) may come before (2).

Similar Messages

  • String Manipulation in BI Publisher Report Paramater

    Hi,
    My Problem is that I am not able to do string manipulation on BI Publisher report Prameters.
    Actually I want to Show Deptno-Dname in Menu(LOV).and when I select Certain combination like '10-Accounting',and while passing the parameter:Dept I wanted to Cut the department no(10) using string manipulation functions provided by oracle in Data Model(Query) in where clause like (where deptno=to_number(substr(:Dept,1,2)).
    This query is working fine in other application like TOAD,But not giving results in BI Publisher Report.
    It's also not giving any error while saving or running the report.
    Please suggest any solution.

    even I tried the following query in data model..
    select DISTINCT EMP.EMPNO as EMPNO,
    EMP.ENAME as ENAME,
    EMP.JOB as JOB,
    DEPT.LOC as LOC
    from SCOTT.DEPT DEPT,
    SCOTT.EMP EMP
    where emp.DEPTNO=DEPT.deptno
    and DEPT.deptno=nvl(to_number(substr(:department,1,2)),DEPT.deptno)
    But the Parameter which I want to pass say Department('10-Accounting'),
    Still it is showing employees from all departments.

  • Core dump with stlport4 and string pointers

    Hello,
    I am porting from SGI Irix to Sun Solaris, using OS 8 and Sun Studio 8. The program we are porting is very very large. We've compiled all code, but now are getting core dumps on several of the executables. We have traced one of the core dumps to a function that deals with string manipulation/string pointers. We wrote a very simple test program that re-produces the problem.
    #include <string>
    #include <iostream>
    void test(char* m)
    std::cout << m << " in test before";
    m[0] = 'z';
    std::cout << m << " in test after";
    void main(void)
    char* temp = new char[10];
    temp = "abcd";
    std::cout << temp << " before test";
    test(temp);
    std::cout << temp << " after test";
    We get the following output:
    abcd before test
    abcd in test before
    Segmentation fault (core dumped)
    The code compiles and runs fine on the SGI Irix system. What am I doing wrong?
    Thanks,
    Bob

    1) The signature of "main" is wrong. It must be 'int
    main(int, char **)'Not quite. The signatures
    int main()
    int main(void)
    are also allowed. (C++ standard, section 3.6.1 Main function)
    A "void" return type on main is not standard, but Sun C++ allows it with a warning. Such a version of main does not return a predictable value to the program that invoked it (usually the shell).
    It seems as if the intent of the program is to
    allocate a new string with the contents "abcd".
    Instead, you allocate a buffer, and then overwrite the
    pointer to that buffer with a pointer to a string
    constant, to which you then attempt to write.Right. By default, the C++ compiler allocates string literals to read-only memory, to catch mistakes like this. The compiler has an option to store literal strings in read-write memory, but we recommend against using the option, since you should not ever want to modify a literal string.
    I am curious why the compiler doesn't complain about
    the assignment in main - to my eyes it looks like it
    should be complaining that you are assigning a const
    char * to a char *The compiler emits a warning about the assignment.
    Such code is allowed but deprecated in the C++ standard, because of the deprecated conversion of "array of const char" to char* (section 4.2 Array-to-pointer conversion).

  • String manipulation in JSTL

    Hello All
    I'm a just a beginner and I'm need to write a web page that is totally based on JSTL. I found out that the standard java tab lib in JSTL doesnt really support string manipulation or regular expression like in perl.
    As such, I would like to know what are the different options (like adding servlets/javabeans/etc) can i add to my JSTL page so that i can perform complex string manipulation to a data entered by the user in the text box?
    Some of the operations that I wish to carry out on the data are:
    1. check if data contains certain characters, strings
    2. joining and spliting strings
    3. find length of the string
    4. find the position of certain character in a string
    5. check if string match certain pattern.
    and many more.
    Would greatly appreciate if you guys can help to provide some light.
    Regards
    Beginner....

    You might find MicroNova YUZU JSP tag library (http://sourceforge.net/projects/micronova-yuzu) useful, especially if you need to support both JSP 1.2 and 2.0. Hope this helps.

  • How to Plot number and string in one row (data logger counter) ?

    hi all i made data log quantity using Digital Counter via modbus to monitoring quantity and reject that has and Name Operator, Machine and Part Number.
    i have problem about plot the number & string in one row, as shown on the picture below :
    how to move that string on one row ? i attach my vi.
    Thanks~
    Attachments:
    MODBUS LIB Counter.vi ‏39 KB

    Duplicate and answered - http://forums.ni.com/t5/LabVIEW/How-to-Plot-number-and-string-in-one-row-data-logger-counter-via/m-p...

  • Pivot and dynamic SQL

    Hi Team,
    I need to write a SQL to cater the requirements. Below is my requirements:
    pagename fieldname fieldvalue account_number consumerID
    AFAccountUpdate ArrangementsBroken dfsdff 1234 1234
    AFAccountUpdate ArrangementsBroken1 dfsdff 1234 1234
    AFAccountUpdate ArrangementsBroken2 dfsdff 1234 1234
    AFAccountUpdate ArrangementsBroken2 dfsdff 12345 12345
    AFAccountUpdate ArrangementsBroken1 addf 12345 12345
    Create table test_pivot_dynamic
    pagename varchar(200),
    fieldname Varchar(200),
    fieldvalue varchar(500),
    N9_Router_Account_Number bigint,
    TC_Debt_Item_Reference bigint
    --Input
    insert into test_pivot_dynamic Values('AFAccountUpdate','ArrangementsBroken','addf',1234,1234)
    insert into test_pivot_dynamic Values('AFAccountUpdate','ArrangementsBroken1','dfsdff',1234,1234)
    insert into test_pivot_dynamic Values('AFAccountUpdate','ArrangementsBroken2','fder',1234,1234)
    insert into test_pivot_dynamic Values('AFAccountUpdate','ArrangementsBroken2','dfdfs',12345,12345)
    insert into test_pivot_dynamic Values('AFAccountUpdate','ArrangementsBroken1','dfdwe',12345,12345)
    insert into test_pivot_dynamic Values('AFAccountUpdate1','Arrangements','addf',1234,1234)
    insert into test_pivot_dynamic Values('AFAccountUpdate1','Test1','dfsdff',1234,1234)
    --Expected output:
    Select 1234,1234,'AFAccountUpdate','ArrangementsBroken','addf','ArrangementsBroken1','dfsdff','ArrangementsBroken2','fder','ArrangementsBroken2','fder'
    Select 12345,12345,'AFAccountUpdate','ArrangementsBroken','addf','ArrangementsBroken1','dfdwe','ArrangementsBroken2','dfdfs'
    Select 1234,1234,'AFAccountUpdate1','Arrangements','addf','Test1','dfsdff'
    so basically we have to pivot and dynamic sql and insert the expected output to a common table which will have all the required fields
    Thanks,Ram.
    Please don't forget to Marked as Answer if my post solved your problem and use Vote As Helpful if a post was useful. It will helpful to other users.

    This should give you what you're looking for
    SELECT N9_Router_Account_Number,TC_Debt_Item_Reference,PageName,
    MAX(CASE WHEN SEQ = 1 THEN fieldname END) AS fieldname1,
    MAX(CASE WHEN SEQ = 1 THEN fieldvalue END) AS fieldvalue1,
    MAX(CASE WHEN SEQ = 2 THEN fieldname END) AS fieldname2,
    MAX(CASE WHEN SEQ = 2 THEN fieldvalue END) AS fieldvalue2,
    MAX(CASE WHEN SEQ = 3 THEN fieldname END) AS fieldname3,
    MAX(CASE WHEN SEQ = 3 THEN fieldvalue END) AS fieldvalue3,
    MAX(CASE WHEN SEQ = 4 THEN fieldname END) AS fieldname4,
    MAX(CASE WHEN SEQ = 4 THEN fieldvalue END) AS fieldvalue4
    FROM
    SELECT *,ROW_NUMBER() OVER (PARTITION BY N9_Router_Account_Number,TC_Debt_Item_Reference,PageName ORDER BY PageName) AS SEQ,*
    FROM test_pivot_dynamic
    )t
    GROUP BY N9_Router_Account_Number,TC_Debt_Item_Reference,PageName
    To make it dynamic see
     http://www.beyondrelational.com/modules/2/blogs/70/posts/10791/dynamic-crosstab-with-multiple-pivot-columns.aspx
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Difference between String=""; and String =null

    I want to know the difference especially the ADVANTAGE between the following-
    1. String s="";
    String s="ABC"
    and
    String s;
    String s="ABC";
    or String s=null;
    String s="ABC";
    2. Object anyObject;
    anyObject-new Object();
    and
    Object anyObject=null;
    anyObject=new Object();

    Tanvir007 wrote:
    I want to know the difference especially the ADVANTAGE between the following-
    1. String s="";s points to the empty string--the String object containing no characters.
    String s="ABC"s points to the String object containing the characters "ABC"
    String s; Declares String reference varialbe s. Doesn't not assign it any value. If it's a local variable, it won't have a value until you explicitly assign it. If it's a member variable, it will be given the value null when the enclosing object is created.
    String s="ABC";Already covered above.
    or String s=null;s does not point to any object.
    String s="ABC";???
    You've already asked this twice.
    Are you talking about doing
    String s = null;
    String s = "ABC";right after each other?
    You can't do that. You can only declare a variable once.
    If you mean
    String s = null;
    s = "ABC";It just does what I described above, one after the other.
    2. Object anyObject;
    anyObject-new Object();
    and
    Object anyObject=null;
    anyObject=new Object();As above: In the first case, its value is undefined until the new Object line if it's a local, or it's null if it's a member.
    As for which is better, it depends what you're doing.

  • How to Sort JTable data using Multiple fields (Date, time and string)

    I have to fill the JTable data with some date, time and string values. for example my table data looks like this:
    "1998/12/14","15:14:38","Unicorn1","row1"
    "1998/12/14","15:14:39","Unicorn2","row2"
    "1998/12/14","15:14:40","Unicorn4","row3"
    "1998/12/17","12:14:12","Unicorn4","row6"
    Now the Sorted Table should be in the following way:
    "1998/12/17","12:14:12","Unicorn4","row6"
    "1998/12/14","15:14:40","Unicorn4","row3"
    "1998/12/14","15:14:39","Unicorn2","row2"
    "1998/12/14","15:14:38","Unicorn1","row1"
    ie First Date field should be sorted, if 2 date fields are same then sort based on time. if date and time fields are same then need to be sorted on String field.
    So if any one worked on this please throw some light on how to proceed. I know how to sort based on single column.
    But now i need to sort on multiple columns.So what is code change in the Comparater class.
    Thanks in advance.. This is urgent....

    I think your Schedule objects should implement Comparable. Then you can sort your linked list using the Collections.sort() method without passing in a Comparator.class Schedule(Date date, String class) implements Comparable
      public void compareTo(Object obj)
        Schedule other = (Schedule)obj;
        return date.getTime() - other.getDate().getTime();
    }

  • In Applet  how to send an ' image' and 'string' as parameter

    Hi,
    In web application, how to use post method in applet to send an ' image' and 'string' as a parameter, I can able to send the image alone form applet to servlet.

    869665 wrote:
    Hi,
    In web application, how to use post method in applet to send an ' image' and 'string' as a parameter, I can able to send the image alone form applet to servlet.One way to do this is to convert your binary image data to base64 (convert it to plain text) and send it along with your other String parameter, delimited with a & of course.
    Edited by: maheshguruswamy on Aug 2, 2011 11:59 AM

  • Video and audio manipulation

    I was reading the documentation for the media and all other related classes, and while there is functionality for video and audio playback, there doesn't seem to be any exposed lower level functionality in order to do things such as simple video and audio manipulation. I was wondering if there is any known way to achieve this? Also, is there any plan to incorporate something of this nature into JavaFx? Thanks in advance.

    Only things I can see in jira for this are:
    1. http://javafx-jira.kenai.com/browse/RT-19742 "Support simple video filters, like deinterlace, in MediaPlayer" (currently unscheduled)
    2. On http://javafx-jira.kenai.com/browse/RT-19582, Brian mentions "we already have separate issues on file for ... and 2) playing from a byte stream.", but I can't find a reference to the jira to play from a byte stream (I guess it's not public).
    If you can create a pretty specific and concise feature request, preferably backed with a use-case example, you can file it for consideration at http://javafx-jira.kenai.com

  • BizTalk Stored Proce-passing XML as one of the Input parameter and String as another parameter

    I have a requirement in BizTalk that
    - I will receive XML from Source and i need to submit this XML data and two other string parameters in  SQL storeprocedure  as a parameters and submit data
    Ex: My_SP(myID Integer INPUT,myXML xml Input,mystring OUT)
    Could you please help me how call storeprocedure and submit multiple parameters in BizTalk.

    you can execute stored procedure by generating schemas from WCF-SQL Adapter.
    for passing parameters you will have to do the mapping to the Generated schema for Stored proc.
    I would suggest to do this in Message Assignment shape, there you can easily assign all the parameters.
    Integer and String parameters can be assigned from normal variables and XML parameter can be inserted as suggested by Abhishek-
    xmldoc=requestMsg;
    varOuterstring=xmldoc.Outerxml.Tostring();
    Please refer the below article.
    https://www.packtpub.com/books/content/new-soa-capabilities-biztalk-server-2009-wcf-sql-server-adapter
    http://msdn.microsoft.com/en-us/library/dd787968.aspx
    Thanks,
    Prashant
    Please mark this post accordingly if it answers your query or is helpful.

  • Kinda urgent    please help pass strings to doubles and strings to ints

    Need to know how to pass strings to doubles and strings to ints
    and to check if a string is null its just if (name == null;) which means black right?
    like size as a string and then make the string size a double

    cupofjava666 wrote:
    Need to know how to pass strings to doubles and strings to ints
    and to check if a string is null its just if (name == null;) which means black right?
    like size as a string and then make the string size a doubleThink he means blank.
    Check the Wrapper classes (Double, Integer) in the api.
    parseInt() parseDouble() both take a string and return a primitive.
    String s = null;
    if(s == null) should do the trick!
    Regards.
    Edited by: Boeing-737 on May 29, 2008 11:08 AM

  • Ios 6 orientation doesn't work and boot time increases. How to solve these issues for dummy? I don't understand code and strings suggested by others.

    I just upgraded from ios 5 to ios 6 on my ipad2. Now orientation doesn't work properly. Boot time increase, it takes longer time to boot. Is there any configuration to solve these issues? I can't understand the explanation with code and strings found on google to solve the orientation issue. Any easy configuration for dummy ?

    It supports well for ios 5. I couldn't remember (5.x.x) exactly but I always keeps update for ios5 and the abnormality starts when I upgraded to ios 6.

  • Pivot and chart drill down

    Hi ,
    Could anyone please let me know how to drill down in pivot and related chart report .
    As because when I drill i get a table view instead of chart.
    Regards,
    Megha

    Hi,
    I believe you are trying to show chart of your pivot table as well in your pivot view. I tried and I can drill down from both chart and its pivot table.
    You need to select drill option under Interaction tab of Additional Charting Option properties of this chart. Save your report and see if drill down in pivot table and in chart in the Pivot view is working.
    Regards,
    Rituraj Kumar.

  • Can't get "pianos and strings" on my 2nd computer. . .

    Weirdest thing. I use an instrument "pianos and strings" - I have purchased GB 08, the JamPack, and the Orchestral JamPack. I have no idea exactly where this particular instrument comes from. It plays fine on my Intel Mac. So I also installed on my laptop, also a G4 but not Intel. A
    For some reason, though Pianos and Strings is listed on the laptop, whenever I select it and/or try to play it, I get an error code that a *.wav file is missing.
    I went and reinstalled everything just in case there was a mistake with the install on the laptop, but nothing changes. I was able to locate the *.wav file the laptop asked for from my other computer and copied it, then GB is now asking for another *.wav file.
    I'm not working with any copied or pirated software, but I can't figure out what's going wrong. Would love any suggestions.
    thanks
    enzosf

    I have the same problem - used to love Piano & Strings and now it can't find the WAV files? They're not on my system any longer? I'm going to try to re-install everything including LOGIC PRO.

Maybe you are looking for

  • HT5634 I use MacBook Air 2013, but cannot install windows 7.

    Just buy MacBook Air 2013, but it stop @ keyboard and mouse installation.

  • Error in Debugging a Custom Planning Function

    Hi All, I have a custom Planning function which is an ABAP code. I wanted to test the planning function and hence i set a breakpoint at the first line of the code. But when i execute the program RSPLS_PLSEQ_EXECUTE to debug my planning function, once

  • Capable of web based survey?

    I'm hoping to put together a web based questionnaire-survey for the membership of an organization. Buttons for yes/no, ranges of "good to bad" w/ choices of 4 or 5 buttons). Is this do-able in iWeb? Are other applications (DreamerWeaver? Filemaker?)

  • Query variant in rsrt

    In RSRT, there is an option to create a query variant. How can we use this? I have a variable on 0calmonth and I want to create variants based on this so I can use it in a APD process. How can I do this? Thanks

  • Where to install theme n95 8gb

    is it better to install in phone memory,or mass memory.does installing application in phone memory,make my phone slow.and does the speed of phone becomes slow if i install many themes and application in either phone or mass memory! bad can always be