Producedure givng two rows instead of one row

Hi
Please find below my procedure..when I execute this proc...displays two rows instead of one row. Please help me incase if I did mistake.
CREATE PROCEDURE SP_CWCTravel_Cruise_Amenities_S(
        @Cruise_Line_Code varchar(2500) = NULL,
        @Ship_Code varchar(2500) = NULL,
        @Sail_Id varchar(100) = NULL,
        @Base_Price decimal(8, 2),
        @Category_Groups varchar(2500) = NULL,
        @Categories varchar(2500) = NULL,
        @Rate_Codes varchar(2500) = NULL,
        @Booking_Date VARCHAR( 10 ),
        @Sail_Start_Date VARCHAR( 10 )
AS
BEGIN
    SELECT  TOP 1 *
    FROM CWCTravel_Cruise_Amenities_Definition as cad
                                JOIN CWCTravel_Cruise_Amenities_Definition_Date_Range AS caddr
                                ON cad.id = caddr.Amenities_Definition_Id
    WHERE Cruise_Line_Code in (SELECT item FROM SF_CWCTravel_GetStrTableFromCommaSeparatedStr(@Cruise_Line_Code))
        AND (Min_Base_Price = 0 OR Min_Base_Price <= @Base_Price)
        AND (Max_Base_Price = 0 OR Max_Base_Price >= @Base_Price)
        AND (Ship_Code IS NULL OR Ship_Code = '' OR Ship_Code IN (SELECT item FROM SF_CWCTravel_GetStrTableFromCommaSeparatedStr(@Ship_Code)))
        AND (Sail_Id IS NULL OR Sail_Id = '' OR Sail_Id IN (SELECT item FROM SF_CWCTravel_GetStrTableFromCommaSeparatedStr(@Sail_Id))) 
        AND (Rate_Codes IS NULL OR Rate_Codes = '' OR ((SELECT COUNT(*) FROM
                                                                                   (SELECT Item FROM dbo.SF_CWCTravel_GetStrTableFromCommaSeparatedStr(@Rate_Codes)) A,
                                                                                   (SELECT REPLACE(REPLACE(Item,'?', '_'), '*', '%') Item FROM dbo.SF_CWCTravel_GetStrTableFromCommaSeparatedStr(Rate_Codes)) B
                                                                                    WHERE A.Item LIKE B.Item) > 0))
                                AND (Category_Groups IS NULL OR Category_Groups = '' OR ((SELECT COUNT(*) FROM
                                                                                   (SELECT Item FROM dbo.SF_CWCTravel_GetStrTableFromCommaSeparatedStr(@Category_Groups)) A,
                                                                                   (SELECT  Item FROM dbo.SF_CWCTravel_GetStrTableFromCommaSeparatedStr(Category_Groups)) B
                                                                                    WHERE A.Item LIKE B.Item) > 0))
                AND (Categories IS NULL OR Categories = '' OR ((SELECT COUNT(*) FROM
                                                                                   (SELECT Item FROM dbo.SF_CWCTravel_GetStrTableFromCommaSeparatedStr(@Categories)) A,
                                                                                   (SELECT  Item FROM dbo.SF_CWCTravel_GetStrTableFromCommaSeparatedStr(Categories)) B
                                                                                    WHERE A.Item LIKE B.Item) > 0))
                                AND  (@Booking_Date is null or @Booking_Date=''
                                                                                                OR (( caddr.from_date IS NULL OR caddr.from_date <= @Booking_Date ) AND ( caddr.to_date IS NULL OR caddr.to_date >= @Booking_Date )                                                                                   
                                                                                AND  (( caddr.date_range_type IS NULL ) OR ( caddr.date_range_type = 'BOOK_DATE' ))) )
    union
    SELECT  TOP 1 *
    FROM CWCTravel_Cruise_Amenities_Definition as cad
                                JOIN CWCTravel_Cruise_Amenities_Definition_Date_Range AS caddr
                                ON cad.id = caddr.Amenities_Definition_Id
    WHERE Cruise_Line_Code in (SELECT item FROM SF_CWCTravel_GetStrTableFromCommaSeparatedStr(@Cruise_Line_Code))
        AND (Min_Base_Price = 0 OR Min_Base_Price <= @Base_Price)
        AND (Max_Base_Price = 0 OR Max_Base_Price >= @Base_Price)
        AND (Ship_Code IS NULL OR Ship_Code = '' OR Ship_Code IN (SELECT item FROM SF_CWCTravel_GetStrTableFromCommaSeparatedStr(@Ship_Code)))
        AND (Sail_Id IS NULL OR Sail_Id = '' OR Sail_Id IN (SELECT item FROM SF_CWCTravel_GetStrTableFromCommaSeparatedStr(@Sail_Id))) 
        AND (Rate_Codes IS NULL OR Rate_Codes = '' OR ((SELECT COUNT(*) FROM
                                                                                   (SELECT Item FROM dbo.SF_CWCTravel_GetStrTableFromCommaSeparatedStr(@Rate_Codes)) A,
                                                                                   (SELECT REPLACE(REPLACE(Item,'?', '_'), '*', '%') Item FROM dbo.SF_CWCTravel_GetStrTableFromCommaSeparatedStr(Rate_Codes)) B
                                                                                    WHERE A.Item LIKE B.Item) > 0))
                                AND (Category_Groups IS NULL OR Category_Groups = '' OR ((SELECT COUNT(*) FROM
                                                                                   (SELECT Item FROM dbo.SF_CWCTravel_GetStrTableFromCommaSeparatedStr(@Category_Groups)) A,
                                                                                   (SELECT  Item FROM dbo.SF_CWCTravel_GetStrTableFromCommaSeparatedStr(Category_Groups)) B
                                                                                    WHERE A.Item LIKE B.Item) > 0))
                AND (Categories IS NULL OR Categories = '' OR ((SELECT COUNT(*) FROM
                                                                                   (SELECT Item FROM dbo.SF_CWCTravel_GetStrTableFromCommaSeparatedStr(@Categories)) A,
                                                                                   (SELECT  Item FROM dbo.SF_CWCTravel_GetStrTableFromCommaSeparatedStr(Categories)) B
                                                                                    WHERE A.Item LIKE B.Item) > 0))
        AND  (@Sail_Start_Date is null or @Sail_Start_Date=''
                                                                                                OR (( caddr.from_date IS NULL OR caddr.from_date <= @Sail_Start_Date ) AND ( caddr.to_date IS NULL OR caddr.to_date >= @Sail_Start_Date )                                                                                   
                                                                                AND  (( caddr.date_range_type IS NULL ) OR ( caddr.date_range_type = 'TRAVEL_DATE' ))) )                                                                        
    ORDER BY Cruise_Line_Code DESC, Ship_Code DESC, Sail_Id DESC, Rate_Codes DESC, Category_Groups DESC, Categories DESC
ENDWhile executing this SP
I am getting the following results.
2043 23-07-2010 AM 11:22:10 23-08-2011 PM 04:57:19 8 princess caribbeanPrincess 2043 20-08-2011 AM 12:00:00 30-11-2011 AM 12:00:00 BOOK_DATE
2043 23-07-2010 AM 11:22:10 23-08-2011 PM 04:57:19 8 princess caribbeanPrincess 2043 01-10-2011 AM 12:00:00 30-11-2011 AM 12:00:00 TRAVEL_DATE
I need only the first record.
Thanks in adv
Rekha

871270 wrote:
Hi
Please find below my procedure..when I execute this proc...displays two rows instead of one row. Please help me incase if I did mistake.Seriously?
You wrote a query against tables we've never seen, containing data we can't possibly have any idea about and you expect us to be able to help you?
Please go discuss this with someone in your organization who understands the data model and have them explain to you how it is supposed to work.
Put yourself in our situation (forum volunteers) ... if we threw some arbitrary code with no explanation as to what it does, what the data model looks like and what's supposed to be happening, do you think you'd be very successful ?

Similar Messages

  • Showing report data columns into two rows instead of one row using SSRS 2012

    Hi All,
    I have a ssrs report with 13 columns and I want to show those 13 columns data into two rows instead of showing in one row. please send me step by step process.
    id     fullname     firstname      lastname        mailingaddress     billingaddress       
    city       state       zipcode   
    1       ABC                A                  C                  
        xyz                      xyz123                   york     
    PA          12345    
     homephone     cellphone          workphone          company    
    1234567890      4567890123     0123456789         ABC,Inc
    id     fullname     firstname      lastname        mailingaddress     billingaddress        
    city          state     zipcode   
    2          XYZ               X                  Z                      
         abc                     abc123           lewisburg     
    PA      54321    
     homephone     cellphone           workphone        company    
    4567890123      0123456789     1234567890         xyz,Inc
    id     fullname     firstname      lastname        mailingaddress     billingaddress        
    city          state     zipcode   
    3       BCD                  B                  D                  
    123abc                  xyz123                leesburg       PA     
     54123    
     homephone     cellphone          workphone        company    
    4567895623      0783456789     1238967890       Hey,Inc
    Thanks in advance,
    RH
    sql

    Do a right mouse click on the left, gray row marker => "Insert Row"=> "Inside Group
    - Above or Below", then you get a second detail row.
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • SQL*Plus two fetches for getting one row.

    Hi all.
    I have tested following script.
    alter session set events '10046 trace name context forever, level 12';
    select * from dual;And achieved such results (extract from .trc file).
    SQL*Plus: Release 11.2.0.1.0; (Oracle Version 10.2.0.4.0, 11.2.0.1.0)
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch        2      0.00       0.00          0          0          0           1
    total        4      0.00       0.00          0          0          0           1SQL*Plus: Release 8.1.7.0.0; (Oracle Version 8.1.7.0.0)
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute      2      0.00       0.00          0          0          0           0
    Fetch        2      0.00       0.00          0          1          4           1
    total        5      0.00       0.00          0          1          4           1Allround Automations PL/SQL Developer 8.0.4; (Oracle Version 10.2.0.4.0, 11.2.0.1.0)
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch        1      0.00       0.00          0          0          0           1
    total        3      0.00       0.00          0          0          0           1Allround Automations PL/SQL Developer 8.0.4; (Oracle Version 8.1.7.0.0)
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch        1      0.00       0.00          0          1          4           1
    total        3      0.00       0.00          0          1          4           11) I can't figure out why sqlplus does TWO fetches for getting ONE row (instead of pl/sql developer).
    8i raw trace
    PARSING IN CURSOR #1 len=31 dep=0 uid=0 oct=3 lid=0 tim=0 hv=3549852361 ad='4a0155c'
    select 'hello world' from dual
    END OF STMT
    PARSE #1:c=0,e=0,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=4,tim=0
    BINDS #1:
    EXEC #1:c=0,e=0,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=4,tim=0
    WAIT #1: nam='SQL*Net message to client' ela= 0 p1=1111838976 p2=1 p3=0
    FETCH #1:c=0,e=0,p=0,cr=1,cu=4,mis=0,r=1,dep=0,og=4,tim=0
    WAIT #1: nam='SQL*Net message from client' ela= 0 p1=1111838976 p2=1 p3=0
    FETCH #1:c=0,e=0,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=0,tim=0
    WAIT #1: nam='SQL*Net message to client' ela= 0 p1=1111838976 p2=1 p3=0
    WAIT #1: nam='SQL*Net message from client' ela= 0 p1=1111838976 p2=1 p3=0
    STAT #1 id=1 cnt=1 pid=0 pos=0 obj=195 op='TABLE ACCESS FULL DUAL '11g raw trace
    PARSING IN CURSOR #3 len=30 dep=0 uid=96 oct=3 lid=96 tim=1581355246985 hv=1158622143 ad='b8a1bcdc' sqlid='5h2yvx92hyaxz'
    select 'hello world' from dual
    END OF STMT
    PARSE #3:c=0,e=130,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=1,plh=1388734953,tim=1581355246984
    EXEC #3:c=0,e=40,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=1,plh=1388734953,tim=1581355247154
    WAIT #3: nam='SQL*Net message to client' ela= 7 driver id=1111838976 #bytes=1 p3=0 obj#=-1 tim=1581355247252
    FETCH #3:c=0,e=18,p=0,cr=0,cu=0,mis=0,r=1,dep=0,og=1,plh=1388734953,tim=1581355247324
    STAT #3 id=1 cnt=1 pid=0 pos=1 obj=0 op='FAST DUAL  (cr=0 pr=0 pw=0 time=0 us cost=2 size=0 card=1)'
    WAIT #3: nam='SQL*Net message from client' ela= 193 driver id=1111838976 #bytes=1 p3=0 obj#=-1 tim=1581355247735
    FETCH #3:c=0,e=2,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=0,plh=1388734953,tim=1581355247800
    WAIT #3: nam='SQL*Net message to client' ela= 5 driver id=1111838976 #bytes=1 p3=0 obj#=-1 tim=15813552478552) Is there any possibility to view data provided by each fetch?
    Thanks in advance!
    P.S.
    SQL> sho arraysize
    arraysize 15

    Thanks.
    I have tested two statements.
    select 'hello world' from dual where 1=1;
    select 'hello world' from dual where 1=0;When query returns no data, there is only one SQL*Net roundtrip (and one fetch)
    SQL> set autot on statistics
    SQL> select 'hello world' from dual where 1=1;
    'HELLOWORLD
    hello world
    Statistics
              0  recursive calls
              0  db block gets
              0  consistent gets
              0  physical reads
              0  redo size
            528  bytes sent via SQL*Net to client
            492  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              1  rows processed
    SQL> select 'hello world' from dual where 1=0;
    no rows selected
    Statistics
              0  recursive calls
              0  db block gets
              0  consistent gets
              0  physical reads
              0  redo size
            329  bytes sent via SQL*Net to client
            481  bytes received via SQL*Net from client
              1  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              0  rows processedBut in both cases i found in client trace this sequence of bytes:
    ] nsprecv: 00 00 36 01 00 00 00 00  |..6.....|
    ] nsprecv: 00 00 00 00 00 00 00 00  |........|
    ] nsprecv: 00 00 90 19 43 13 00 00  |....C...|
    ] nsprecv: 00 00 00 00 00 00 00 00  |........|
    ] nsprecv: 00 00 00 00 00 00 00 00  |........|
    ] nsprecv: 00 00 00 00 00 00 00 00  |........|
    ] nsprecv: 00 00 00 00 00 00 00 00  |........|
    ] nsprecv: 00 00 00 00 00 00 00 00  |........|
    ] nsprecv: 00 00 00 00 00 00 00 00  |........|
    ] nsprecv: 00 00 00 00 00 00 00 00  |........|
    ] nsprecv: 00 00 19 4F 52 41 2D 30  |...ORA-0|
    ] nsprecv: 31 34 30 33 3A 20 6E 6F  |1403:.no|
    ] nsprecv: 20 64 61 74 61 20 66 6F  |.data.fo|
    ] nsprecv: 75 6E 64 0A              |und.    |In first case - it was in 2nd packet and in second case (query returns no data) - part of 1st packet.

  • Obiee 11.1.1.6.6 - analysis displays two dates instead of one prompted

    Hi all,
    my analysis somehow displays two dates instead of one prompted.
    How can it be?
    Tell me please what additional information should I include for you to help me.
    obiee 11.1.1.6.6
    Upd: prompt screenshots
    http://marchello.ccx-grads.org/img/BI_prompt_001.png
    http://marchello.ccx-grads.org/img/BI_prompt_002.png

    This is from "Administration" -> "Manage Sessions" section of obiee
    1) everything seems fine, WHERE clause shows correct date
    SET VARIABLE QUERY_SRC_CD='Report',SAW_SRC_PATH='/shared/VB/8.RB-213.BI.1';SELECT
       0 s_0,
       "VB"."VBIREP8"."AASYSDATE" s_1,
       "VB"."VBIREP8"."ADAY" s_2,
       "VB"."VBIREP8"."AMONTH" s_3,
       "VB"."VBIREP8"."ARCDATE" s_4,
       "VB"."VBIREP8"."AYEAR" s_5,
       "VB"."VBIREP8"."CONTRAGENTID" s_6,
       "VB"."VBIREP8"."CONTRAGENTNAME" s_7,
       "VB"."VBIREP8"."CREDITS" s_8,
       "VB"."VBIREP8"."DEPOSITARY" s_9,
       "VB"."VBIREP8"."DEPOSITS" s_10,
       "VB"."VBIREP8"."IDENTIFYCODE" s_11,
       "VB"."VBIREP8"."OVERDAY30" s_12,
       "VB"."VBIREP8"."RESTRUCTURED" s_13,
       "VB"."VBIREP8"."SEGMENT" s_14,
       "VB"."VBIREP8"."STATUS" s_15,
       "VB"."VBIREP8"."TOBO" s_16
    FROM "VB"
    WHERE
    (CAST("VBIREP8"."ARCDATE" AS DATE) = date '2013-08-15')
    ORDER BY 1, 3 ASC NULLS LAST, 4 ASC NULLS LAST, 6 ASC NULLS LAST, 5 ASC NULLS LAST, 7 ASC NULLS LAST, 8 ASC NULLS LAST, 12 ASC NULLS LAST, 15 ASC NULLS LAST, 16 ASC NULLS LAST, 9 ASC NULLS LAST, 14 ASC NULLS LAST, 13 ASC NULLS LAST, 11 ASC NULLS LAST, 10 ASC NULLS LAST, 17 ASC NULLS LAST, 2 ASC NULLS LAST
    FETCH FIRST 100000001 ROWS ONLY
    2) and now attention, I press "next rows" arrow, my WHERE clause is simply ABSENT! 
    SET VARIABLE QUERY_SRC_CD='Report',SAW_SRC_PATH='/shared/VB/8.RB-213.BI.1';SELECT
       0 s_0,
       "VB"."VBIREP8"."AASYSDATE" s_1,
       "VB"."VBIREP8"."ADAY" s_2,
       "VB"."VBIREP8"."AMONTH" s_3,
       "VB"."VBIREP8"."ARCDATE" s_4,
       "VB"."VBIREP8"."AYEAR" s_5,
       "VB"."VBIREP8"."CONTRAGENTID" s_6,
       "VB"."VBIREP8"."CONTRAGENTNAME" s_7,
       "VB"."VBIREP8"."CREDITS" s_8,
       "VB"."VBIREP8"."DEPOSITARY" s_9,
       "VB"."VBIREP8"."DEPOSITS" s_10,
       "VB"."VBIREP8"."IDENTIFYCODE" s_11,
       "VB"."VBIREP8"."OVERDAY30" s_12,
       "VB"."VBIREP8"."RESTRUCTURED" s_13,
       "VB"."VBIREP8"."SEGMENT" s_14,
       "VB"."VBIREP8"."STATUS" s_15,
       "VB"."VBIREP8"."TOBO" s_16
    FROM "VB"
    ORDER BY 1, 3 ASC NULLS LAST, 4 ASC NULLS LAST, 6 ASC NULLS LAST, 5 ASC NULLS LAST, 7 ASC NULLS LAST, 8 ASC NULLS LAST, 12 ASC NULLS LAST, 15 ASC NULLS LAST, 16 ASC NULLS LAST, 9 ASC NULLS LAST, 14 ASC NULLS LAST, 13 ASC NULLS LAST, 11 ASC NULLS LAST, 10 ASC NULLS LAST, 17 ASC NULLS LAST, 2 ASC NULLS LAST
    FETCH FIRST 100000001 ROWS ONLY
    Sure, I receive another date (01.02.2013). Just one thing is strange here - why do I receive only one extra date (I should receive ALL dates in Oracle table when I perform query without any WHERE clause).

  • Missing rows / output only one row in a Report after applying patchset 2

    Hi.
    We use Reports Builder for 10g R2. We had the problem with our AS 10g R2 on windows 2003, that some reports creates duplicate rows when it is a ASCII report (desformat = delimited), see Bug 3340546.
    Now we apply Patchset 2 on a local machine, to test the functionality. It fix the problem (look in metalink doc ID 398955.1 under "2.12 Oracle Reports Developer Bugs")-
    But now most csv reports creates only one row instead of multiple rows.
    We run reports on our local machine with OC4N and local started Form (via Forms Builder) to generate the reports (local started report server) from DevSuite).
    When we start the reports with desformat=delimited the txt-file has only the header row and one data row (instead of multiple ones).
    And when we generate the same report with desformat=delimiteddata it looks fine and generates all rows as expected.
    We found neither here in the forum or in metalink knowledge base nor on the internet.
    Have you any suggestions for us how to fix this problem?
    Using delimiteddata is now acceptable solution for us, because delimited is easier to use.
    Thanks for your help!

    Hey folks.
    We have solved the problem. :)
    We applied PatchSet2 for 10gR2. But we don´t know how the csv-report outputs only 1 data-row instead of several rows.
    Than we create a similar report (with the same sql-query) as a new one with the reports builder assistant.
    This one works pretty fine. So we looked for the attributes and see the "max. number datasets for each site" and it was in the new one set to 0 and in our old one set to 1.
    So we change this and ... the old one works pretty fine! :)
    So the problem is, that this attribute does not had any consequences in the old version. But since we update with PatchSet 2 it respect this attribute but we don´t "see" it.
    Hope this helps others.

  • When typing an email, when I go to next line, it skips two lines instead of one line. How do I correct it?

    I was typing an email and when I would go to the next line, it will skip two lines instead of one line. How do I correct the problem?

    I am not sure I understand the problem. Could you include a screenshot of it right after it happens?
    If you need help to create a screenshot, please see [[How do I create a screenshot of my problem?]]
    Once you've done this, attach the saved screenshot file to your forum post by clicking the '''Browse...''' button below the ''Post your reply'' box. This will help us to visualize the problem.
    Thank you!

  • Query result area on the first row instead of last row

    Hi BI experts,
    I want to display the result of  the BI query at the first row instead of last row.Could somebody help me how to accomplish this.
    I tried with the layout->move result area but could not be possible.
    I need your kind suggetion.
    Thanks.

    hi jyuoti,
    Further, open your query in query designer, look at the query property,  under the tab "rows/columns"
    change the result position of rows to "Below", you can see the preview there itself.
    This should solve your problem.
    Best Regards,
    *Assign points if you find the answer useful.

  • Two rows instead of one in the database when form with 2 data blocks.

    Hi All,
    I have created a form having 2 data blocks
    data block one to populate table A
    data block two to populate table B .
    now when i save the data after pressing the save option ....i find 2 records instead of one in the database table A and Table B.
    it should have been just one per table ....can some one suggest pls
    Sunny

    ok : step by step :
    do you have a trigger created named "ON-INSERT" on
    the block?Many thanks for your support....
    I do not have an ON-insert trigger.....
    I will explain my scenerio.....
    I have 2 data blocks one-below the other in the form
    accessing 2 different tables....
    now on the canvas of this form I have added a
    button....and on that button i have written a trigger
    'when-button-pressed' Trigger....
    it takes the data from the various text_items of the
    form and inserts them into their corrosponding
    tables....and I have added 'COMMIT' at the end this
    trigger
    so when I press this button ....the data 2 records
    get inserted into the 2 tables instead of one each..
    TIA
    Sunnythe above form looks something like this.....
    -------------------------------------------------------------------------------------------------------|
    |------------------------------------------------------------------------------------------------------|
    | |
    | ---data_block1------------------------------------------------------ |
    | | | |
    | | some data entry here for emp1 table | |
    | |__________________________________________ | |
    | |
    | |
    | |
    | ---data_block2------------------------------------------------------ |
    | | | |
    | | some data entry here for dept1 table | |
    | |__________________________________________ | |
    | |
    | button1 |
    |-------------------------------------------------------------------------------------------------------

  • Depicting multiple rows' data in one row

    Hi All,
    Pls. check the below query:
    select manager_id mg_id, employee_id emp_id, last_name name from employees
    where manager_id = '100'
    and DEPARTMENT_ID = '80'if i run the following query, then o/p comes row wise; like below:
           mg_id           emp_id            name
           100             145                     Russell
           100             146                     Partners
           100             147                     Errazuriz
           100             148                     Cambrault
           100             149                     Zlotkeybut if i want the o/p like below; i.e; under manager # 100, all employees' emp_id and name should come in only ONE row NOT in multiple rows:
    mg_id                   emp_id     name          emp_id       name       emp_id     name         emp_id     name                emp_id         name
    100                             145             Russell     146       Partners        147     Errazuriz       148              Cambrault        149        Zlotkeypls. help me to sort out the above sought o/p.
    kindly tell me if there is any posting guidelines (except "Plain Text Help" on the right side) in this forum. i tried a lot to post above two o/p in easily readable format, but couldn't do that.
    Edited by: Shariful on Sep 20, 2009 4:28 AM
    Edited by: Shariful on Sep 20, 2009 4:29 AM

    Hi,
    Shariful wrote:
    Hi All,
    Pls. check the below query:
    select manager_id mg_id, employee_id emp_id, last_name name from employees
    where manager_id = '100'
    and DEPARTMENT_ID = '80'
    if i run the following query, then o/p comes row wise; like below:
    mg_id           emp_id            name
    100     145     Russell
    100     146     Partners
    100     147     Errazuriz
    100     148     Cambrault
    100     149     Zlotkey
    but if i want the o/p like below; i.e; under manager # 100, all employees' emp_id and name should come in only ONE row NOT in multiple rows:
    mg_id                   emp_id     name          emp_id       name       emp_id     name         emp_id     name                emp_id         name
    100     145     Russell     146     Partners     147     Errazuriz     148     Cambrault     149     ZlotkeyIf you want all the emp_ids and names concatenated into one big VARCHAR2 column, that's called String Aggregation
    [AskTom.oracle.com|http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:2196162600402] shows several different ways to do it.
    You can format that one big column so that it looks like separate columns.
    If you want each emp_id and name in its own column, that's called Pivoting .
    Look up "pivot" for various techniques. If you do not know exactly how many rows were in the original query (and therefore how many columns you'll need in the output), then it will require Dynamic SQL , which can be complicated.
    Unfortunately, when you do search for "pivot", mlost of the hits will be things like "Search for pivot and you'll get lots of examples".
    Re: Help for a query to add columns is one that actually has some information. It was a question very much like yours.
    kindly tell me if there is any posting guidelines (except "Plain Text Help" on the right side) in this forum. i tried a lot to post above two o/p and query in easily readable format, but couldn't do that.Type these 6 characters:
    (small letters only, inside curly brackets) before and after formatted text, to preserve spacing.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to concatenate many rows to be one row?

    Hi,
    How can I do if I concatenate two rows or many rows become one row in the same column with different values (CHAR or VARCHAR2). It's possible to do that?
    Ex:
    Column A
    ABCD
    EFGH
    to become
    Column A
    ABCDEFGH....
    Anybody can help me, please...
    I will very appreciated.
    Thanks,
    Leny

    I'm not sure if SQL Plus supports this feature. But programmatically it is possible if you use oracle procedure. Also if you're using some front end application (like VB, ASP etc) where you need the concatenated result then you can easily concatenate all rows under a loop on Recordset.

  • Datagrid: Vertical Rows instead of Horizontal Rows

    Hi,
    Usually, inside a datagrid there are rows and columns.
    The rows shows ex. one product for each line. Each product has some properties like number, color, weight,...
    What we wanted to do is not to show one product per line, but 1 product per column: --> see the example
    Normal Datagrid:
    Number            Description          Color           Weight   ...
    1                     Product 1             red              10 kg
    2                     Product 2             green           15 kg
    3                     Product 3             blue             5 kg
    What we want is:
    Number           1                   2                     3
    Description      Product 1       Product 2        Product 3
    Color               red                green              blue
    Weight            10 kg             15 kg              5 kg
    Possible to do with standard Flex SDK?
    Did anyone write such a component already with Flex 3 or Flex 4?
    Thanks for any help on that issue.

    A pivot table is something else...
    To change the datasource is possible, but the result is not what is correct.
    cause:
    - The selection of one product must be a vertical selection, and not a horizontal one.
    - The column header must be at the left side, and not at the top!
    But yes, sure, everything is possible to develop....
    thanks anyway :-)

  • Email to MMS on iOS 6 shows two senders instead of one?

    I've been using a group email to forward messages to several recipient's email and MMS. Ever since upgrading to iOS 6, the users with iPhones receiving the message through their carrier's mms email ([email protected] for example) show that the message was from two people, and not one. It shows as coming from myself, and then also the address that the original message was sent to (ie. the group email). The problem is, if they reply, the reply is sent to the entire group of 30 people instead of just me. Didn't have the problem before the update, but it is consistent ever since. Any idea how to overcome this? I've tested out iPhone 4, 4S and 5, with iOS 6 and 6.0.1.

    I have the same issue - the new folder appeared in the Videos app on the iPad when I downloaded How I Met Your Mother season 6 episode 3 directly on the iPad. Previously I had downloaded episodes 1 and 2 on my Mac, and then transferred them to the iPad doing a Sync in iTunes. So now I have two icons for Season 6 of How I Met Your Mother in the Videos app on my iPad: one with episode 3 that I downloaded on the iPad itself, and one with episodes 1 and 2 that I downloaded on my Mac. Both have the same folder name, and both have the same icon for Season 6.
    Were you able to resolve the issue? A complete reboot of the iPad did not resolve the issue for me.
    Many thanks,
    Pete

  • JDBC Inbound to separate IDOCS per Row instead of one single IDOC?

    Hello everyone,
    I'm currently working on the migration of our old B1iSN 8.8 scenarios to B1iSN 9.0.
    The scenario is the following: I have a SQL table with data and a separate control table where I store the date of the last run/data retrieval. My JDBC Inbound is triggered every day and the SQL Statement selects all new data between now and the last run. The process flow only consists of one transformation Atom which builds my custom idoc structure.
    In B1iSN 8.8 I've got one IDOC per row from the resultset. In the B1 9.0 outbound all rows are now withing one single IDOC. How can I trigger that separate IDOCS are created!?
    I've already tried the "Block Size" Setting. When I set it to "1" I get for two datasets two output IDOCS. However all data is in IDOC 1 and the second IDOC is empty. What is wrong here? How can I access the data in the current block? I currently use a "for each" on the normal jdbc resultset rows.
    I'm testing it at the moment with flat file output as our target system is not accessible yet, but I suppose this is not the reason?
    Thanks in advacne for any help.

    Hello André,
    please use a two-step approach with two integration scenarios:
    DB INBOUND -> VOID OUTBOUND
    INTERNAL QUEUE INBOUND -> ECC OUTBOUND
    In step one add a condtion including a for-each loop into your integration flow.
    Within this for-each please hand over for each IDoc you want to create into a second integration step via "Internal queue":
    The second step is triggered x-times via internal queue and does the field mapping into IDoc format.
    Best regards
    Bastian
    P.S.: with this approach, you can keep the block processing setting for DB INBOUND to an higher amount.

  • ICACLS creates two entries instead of one

    I am using the command ICACLS to create permission for one user on the drive d:\. I use the following syntax.
    icacls d:\ /grant "wkusr":(X,RD,RA,REA,RC) /T
    icacls d:\ /deny "wkusr":(AD,WA,WEA,DC,D,WDAC,WO) /T 
    Instead of creating one entry in the Advanced Security Settings of drive D:\ I have two, one for the Allow and the other for deny. How can I have only one entry?
    Or does the above commands do exactly what I need no matter if I have one or two entries?
    Thanks

    Hi Louis,
    Do you mean tow permissions on one user in security->advanced->Permissions Tab?
    It is very normal because this is different type of permission modification. There will be tow entries even you grant permission by using GUI, it will be shown as two different permission in advanced->Permissions Tab (deny and allow). These two entries
    will do its job fine.
    If the commands has conflict, the new one will replace conflicts part in the older one.
    Regards
    D. Wu
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • Every time I load my igoogle home page opening firefox, it opens it in two tabs instead of one, and then AVG tells me firefox is using too much memory and I should close and reopen it; Why

    I open firefox using my igoogle home page and immediately it opens two igoogle tabs on top instead of just one how do I stop it from opening the second one? and then after about two minutes AVG tells me firefox is using too much memory slowing my machine and tells me to close and reopen fire fox...how do I fix that?

    Make sure that Firefox closes properly and that that there are no longer Firefox or plugin-container processes left on the Processes tab in the Task Manager. Otherwise session restore will reopen the page(s) from the previous session.
    See "Hang at exit":
    * http://kb.mozillazine.org/Firefox_hangs
    * https://support.mozilla.com/kb/Firefox+hangs

Maybe you are looking for

  • Javax.swing.text.TableView bug in 1.4 beta 2 ?

    Hi, I derived a class from TableView, which worked fine with 1.3, but now causes the following exception as soon as being layouted: java.lang.Error: should not happen: class com.lexetius.swing.text.LexTableView at javax.swing.text.BoxView.baselineLay

  • IBook G4 to HDTV

    Hello, I have searched this and other fora and am still unclear about everything I need in order to hook up my TV to my laptop. I have an iBook G4 for a computer and a Samsung LED TV 6000 (which is HDTV) for the TV. I believe that the video output fo

  • Closing of sales order

    Dear All, I am closing the sales order by giving the reason for rejection on item level status reason for rejection, after saving the SO will be closed. But if u again go to vao2 and select the reason for rejection as blank the so will be open. Now I

  • Validations not happening

    hi , Im having a adf read only table and an adf form on separate jsf fragments on a same jspx file. I am setting a partial target on the selection listener on read only table such that i will get the values in form on selection of row in the table. B

  • Email attachment Microsoft vs Adobe Reader

    I have a Dell Inspiron 2200 notebook and out of the blue when I open an attachment to an email Microsoft Word converts the attachment to unreadable info instead of opening it with Adobe Reader. Anyone have an idea what is going on? Thanks, Ilene