JDBC Query Single Row service Parse Query

Using JDBC Query Single Row service on an Oracle database,
I specify a SQL statement like this:
select abc, to_char(aDate, 'MM/DD/YYYY') from xyz where def = 123
then I click the "Parse Query" button to try to map the query results to my variables, but the mapping window gives me 3 fields instead of 2:
1. abc
2. to_char(aDate)
3. 'MM/DD/YYYY'
how do I let it understand that there are only 2 fields in the results so that I can map it properly?
thanks

Got a new minor issue unrelated to the above, but I don't want to flood this forum with another new topic, so I'll stick this new thing here.
I have a very simple process that only contains this JDBC Query Single Row service.
In this query single row service, at the bottom of the property sheet, there's a section where it says "number of rows retrieved"...
now, if I map this 'number of rows' to a variable (I set the variable's type as "int"), when I call my process (as a web service), it returns me nothing... all the output parameters are empty.
If I remove the mapping of "number of rows", that is, there's nothing in that bottom section. Then my process works correctly, all the output variables contain correct data from my database.
Has anybody encountered this? what's your solution please?

Similar Messages

  • Bold a single row in a Report based on SQL Query

    Should be easy? So, how do I bold a single row in a report based on SQL query without creating a new template or writing Java for the page? What is the Tabular Form Element "Element Attributes" field for? Or what am I supposed to put in there to make it do anything?

    One way to do this is to add a hidden column to your report which contains the formatting value, for example:
    select empno
    , ename
    , sal
    , decode(empno,1,'font-weight:bold','font-weight:normal') style
    from emp
    Hide the STYLE column.
    Then you can use this column for each column in Column Formatting > HTML expression in this way:
    <span style="#STYLE#">#SAL#</span>
    Unfortunately you have to do this for each colum you want to appear bold.
    good luck,
    Dirk Dral

  • Oracle query - Merging multiple rows into a single row output

    Hi All,
    I have to have a multiple row output to be converted into a single row output.My current output looks as follows:
    ID YR INC_CODE OFFN SCHOOLNO
    8006 2002 00175 SC03 12
    8006 2002 00175 DC06 12
    8006 2002 00175 DC03 12
    8006 2002 00175 DC02 12
    ID,INCIDENT CODE,OFFENSE are all Primary keys
    So I need the output as follows:(IN ONE ROW)
    ID YR INC_CODE OFFN1 OFFN2 OFFN3 OFFN4 SCHOOLNO
    8006 2002 00175 SC03 DC06 DC03 DC02 12
    Can you help me on this since have been spinning the wheel and this has to be a query since will have couple of tables join to produce a materialized view.
    Thanks in advance

    Hi Nigel,
    Thanks for the reply I tested out the portion having the decode and I get the output as follows:
    ID YR INC_CODE OFFN1 OFFN2 OFFN3 OFFN4 OFFN5
    8982 2002 2175 DOC01 -----------------------
    8982 2002 2175 DOC02-------------------
    8982 2002 2175 DOC03------------
    8982 2002 2175 DOC06-------
    8982 2002 2175 SCV03
    There is no value as max for OFFN and each INC_CODE MAY HAVE UP TO A MAX OF 5 OFFN.My query is as follows:
    select distinct STU_STUDENT_ID, INC_BEG_SCH_YR,INC_INCIDENT_CODE
    , decode(rank() over (partition by INC_CODE order by OFFN),1,OFFN,null) as offn1
    , decode(rank() over (partition by INC_CODE order by OFFN),2,OFFN,null) as offn2
    , decode(rank() over (partition by INC_CODE order by OFFN),3,OFFN,null) as offn3
    , decode(rank() over (partition by INC_CODE order by OFFN),4,OFFN,null) as offn4
    , decode(rank() over (partition by INC_CODE order by OFFN),5,OFFN,null) as offn5
    from stu_offn where
    stu_offn.ID = '8982' and stu_offn.INC_CODE = '2175'
    (****Where clause is just given to just check a value)
    So as you know I need to just have all the OFFN in a single row ie as follows:
    ID YR INC_CODE OFFN1 OFFN2 OFFN3 OFFN4 OFFN5
    8982 2002 2175 DOC01 DOC02 DOC03 DOC06 SCV03
    Can you just give me a step by step procedure to go through this and the table in this case is just 'STU_OFFN'
    Thanks for the earlier reply appreciate it!
    ****Sending this again to show the exact way the output is coming

  • Need a query to merge output in a single row?

    Hi All,
    I need a query to merge output in a single row.
    Query :
    Select dname from dept.
    Actual output is :
    Dname
    EDP
    ACCOUNT
    GR
    Desired Output is:
    Dname
    EDP ACCOUNT GR
    Please provide me the solution
    Thanks
    Amit

    select max(sys_connect_by_path (t.name,' '))  from  ( select id,
                            name,
                            group_id,
                            row_number() over (partition by group_id order by id) rn
                       from ( select 1 id, 'test'  name, 1 group_id from dual
                              union
                              select 2 id, 'test1' name, 1 group_id from dual
                              union
                              select 3 id, 'test2' name, 1 group_id from dual
                              union
                              select 4 id, 'test3' name, 1 group_id from dual)  ) t
    start with t.rn = 1 and id = 1
    connect by t.rn = prior t.rn + 1
    group by t.group_id

  • ORA-01427:single-row sub query returns more than one row (group by)

    Hello every one, I am very new to this field , and Right now I am working with this sql, where BEG_BAL_WKST,WKST_RECEIVED_NUM,WKST_PROCESSED_NUM,WKST_CANCELED_NUM are needs to be grouped by,but I am getting the "single-row sub query returns more than one row".
    This is the query I am using in my source qualifier:
    select
    SUM(tmp.WIP_TO_BILL_LOC_AMT) AS WIP_TO_BILL_LOC_AMT,
    sum(tmp.REALIZATION_LOC_AMT) AS REALIZATION_LOC_AMT,
    SUM(tmp.NEG_REAL_LOC_AMT) AS NEG_REAL_LOC_AMT,
    sum(tmp.POS_REAL_LOC_AMT) AS POS_REAL_LOC_AMT,
    sum(tmp.BILL_IN_ADVANCE_LOC_AMT) AS BILL_IN_ADVANCE_LOC_AMT,
    sum(tmp.CARRY_FORWARD_LOC_AMT) AS CARRY_FORWARD_LOC_AMT,
    sum(tmp.BILL_TO_CLIENT_LOC_AMT) AS BILL_TO_CLIENT_LOC_AMT,
    sum(tmp.REMAIN_WIP_TO_BILL_LOC_AMT) REMAIN_WIP_TO_BILL_LOC_AMT,
    sum(tmp.AR_INV_AMT) AS AR_INV_AMT,
    sum(tmp.AR_TAX_AMT) AS AR_TAX_AMT,
    tmp.BEG_BAL_WKST_NUM AS BEG_BAL_WKST_NUM,
    tmp.WKST_RECEIVED_NUM AS WKST_RECEIVED_NUM,
    tmp.WKST_PROCESSED_NUM AS WKST_PROCESSED_NUM,
    tmp.WKST_CANCELED_NUM AS WKST_CANCELED_NUM,
    tmp.DURATION AS DURATION,
    tmp.NUM_DAYS AS NUM_DAYS,
    tmp.NUM_HOURS AS NUM_HOURS,
    tmp.NUM_MINUTES AS NUM_MINUTES,
    tmp.NUM_SECONDS AS NUM_SECONDS,
    tmp.LEAD_PROJECT_OFFICE_CODE AS LEAD_PROJECT_OFFICE_CODE,
    tmp.LEAD_PROJECT_TEAM_CODE AS LEAD_PROJECT_TEAM_CODE,
    tmp.ORG_ID AS ORG_ID,
    tmp.RPT_DATE AS RPT_DATE,
    tmp.RPT_DATE_WID AS RPT_DATE_WID,
    tmp.LOCAL_CURR_CODE AS LOCAL_CURR_CODE,
    tmp.USD_EXCH_RATE AS USD_EXCH_RATE,
    tmp.EUR_EXCH_RATE AS EUR_EXCH_RATE,
    tmp.GBP_EXCH_RATE AS GBP_EXCH_RATE
    from(
    SELECT
    WIP_TO_BILL_LOC_AMT as WIP_TO_BILL_LOC_AMT ,
    REALIZATION_LOC_AMT AS REALIZATION_LOC_AMT,
    NEG_REAL_LOC_AMT AS NEG_REAL_LOC_AMT ,
    POS_REAL_LOC_AMT AS POS_REAL_LOC_AMT,
    BILL_IN_ADVANCE_LOC_AMT AS BILL_IN_ADVANCE_LOC_AMT ,
    CARRY_FORWARD_loc_AMT AS CARRY_FORWARD_LOC_AMT,
    bill_to_client_LOC_AMT AS BILL_TO_CLIENT_LOC_AMT ,
    REMAIN_WIP_TO_BILL_LOC_AMT AS REMAIN_WIP_TO_BILL_LOC_AMT,
    AR_inv_AMT AS AR_INV_AMT,
    ar_tax_amt AS AR_TAX_AMT,
    (SELECT count(distinct(RPAD(INTEGRATION_ID,32)))
    FROM wc_twfs_olb_invoice_history_f
    WHERE ((inv_status_type='FIN'AND inv_status_code NOT IN ('COMPLETE','PROCESSED'))
    OR (inv_status_type='WS' AND inv_status_code NOT IN ('PRC'))) --COMPLETED
    AND to_char((sysdate-5),'YYYYMMDD') between to_char(status_start_dt,'YYYYMMDD') and to_char(status_end_dt,'YYYYMMDD')group by rpad(integration_id,32)) AS BEG_BAL_WKST_NUM ,
    (SELECT count(distinct(RPAD(INTEGRATION_ID,32)))
    FROM wc_twfs_olb_invoice_history_f
    WHERE (inv_status_code='NEW')
    AND to_char((sysdate-4),'YYYYMMDD') between to_char(status_start_dt,'YYYYMMDD') and to_char(status_end_dt,'YYYYMMDD')group by rpad(integration_id,32))AS WKST_RECEIVED_NUM ,
    (SELECT count(distinct(RPAD(INTEGRATION_ID,32)))
    FROM wc_twfs_olb_invoice_history_f
    WHERE ((inv_status_type='FIN' and inv_status_code IN ('COMPLETE','PROCESSED'))
    OR (inv_status_type='WS' AND inv_status_code IN ('PRC'))) --COMPLETED
    AND to_char((sysdate-4),'YYYYMMDD') between to_char((status_start_dt),'YYYYMMDD') and to_char((status_end_dt),'YYYYMMDD')group by rpad(integration_id,32))AS WKST_PROCESSED_NUM ,
    (SELECT count(distinct(RPAD(INTEGRATION_ID,32)))
    FROM wc_twfs_olb_invoice_history_f
    WHERE (inv_status_type='FIN' AND inv_status_code='CANCELLED')
    AND to_char((sysdate-4),'YYYYMMDD') between to_char((status_start_dt),'YYYYMMDD') and to_char((status_end_dt),'YYYYMMDD')group by rpad(integration_id,32)) AS WKST_CANCELED_NUM,
    DURATION AS DURATION,
    NUM_DAYS AS NUM_DAYS,
    NUM_HOURS AS NUM_HOURS,
    NUM_MINUTES AS NUM_MINUTES,
    NUM_SECONDS AS NUM_SECONDS,
    lead_project_office_code AS LEAD_PROJECT_OFFICE_CODE,
    lead_project_team_code AS LEAD_PROJECT_TEAM_CODE,
    org_id AS ORG_ID,
    trunc(sysdate-1) AS RPT_DATE,
    to_char((sysdate-1),'YYYYMMDD') AS RPT_DATE_WID,
    --last_day(a.report_date) mth_end_dt,
    LOC_CURR_CODE AS LOCAL_CURR_CODE,
    usd_exch_rate AS USD_EXCH_RATE,
    eur_exch_rate AS EUR_EXCH_RATE,
    gbp_exch_rate AS GBP_EXCH_RATE
    FROM Wc_twfs_olb_invoice_history_f
    Where
    RPT_DT_MCAL_PERIOD_WID =(select max(RPT_DT_MCAL_PERIOD_WID)from Wc_twfs_olb_invoice_history_f))tmp
    group by BEG_BAL_WKST_NUM,WKST_RECEIVED_NUM,WKST_PROCESSED_NUM,WKST_CANCELED_NUM,DURATION,NUM_DAYS,NUM_HOURS,NUM_MINUTES,NUM_SECONDS,
    LEAD_PROJECT_OFFICE_CODE,LEAD_PROJECT_TEAM_CODE,ORG_ID,RPT_DATE,RPT_DATE_WID,
    LOCAL_CURR_CODE,USD_EXCH_RATE,EUR_EXCH_RATE,GBP_EXCH_RATE;
    Can you please suggest me what to do next, and what would be the solution to this.
    Thanks a lot in advance. please show me some direction.

    you may want to change it something like
    SELECT SUM(Wip_To_Bill_Loc_Amt) AS Wip_To_Bill_Loc_Amt,
           SUM(Realization_Loc_Amt) AS Realization_Loc_Amt,
           SUM(Neg_Real_Loc_Amt) AS Neg_Real_Loc_Amt,
           SUM(Pos_Real_Loc_Amt) AS Pos_Real_Loc_Amt,
           SUM(Bill_In_Advance_Loc_Amt) AS Bill_In_Advance_Loc_Amt,
           SUM(Carry_Forward_Loc_Amt) AS Carry_Forward_Loc_Amt,
           SUM(Bill_To_Client_Loc_Amt) AS Bill_To_Client_Loc_Amt,
           SUM(Remain_Wip_To_Bill_Loc_Amt) AS Remain_Wip_To_Bill_Loc_Amt,
           SUM(Ar_Inv_Amt) AS Ar_Inv_Amt,
           SUM(Ar_Tax_Amt) AS Ar_Tax_Amt,
           COUNT(DISTINCT CASE
                   WHEN ((Inv_Status_Type = 'FIN' AND
                        Inv_Status_Code NOT IN ('COMPLETE', 'PROCESSED')) OR
                        (Inv_Status_Type = 'WS' AND Inv_Status_Code NOT IN ('PRC'))) --COMPLETED
                        AND To_Char((SYSDATE - 5), 'YYYYMMDD') BETWEEN
                        To_Char(Status_Start_Dt, 'YYYYMMDD') AND
                        To_Char(Status_End_Dt, 'YYYYMMDD') THEN
                    Rpad(Integration_Id, 32)
                 END) AS Beg_Bal_Wkst_Num,
           /*(SELECT COUNT(DISTINCT(Rpad(Integration_Id, 32)))
              FROM Wc_Twfs_Olb_Invoice_History_f
             WHERE ((Inv_Status_Type = 'FIN' AND
                   Inv_Status_Code NOT IN ('COMPLETE', 'PROCESSED')) OR
                   (Inv_Status_Type = 'WS' AND Inv_Status_Code NOT IN ('PRC'))) --COMPLETED
               AND To_Char((SYSDATE - 5), 'YYYYMMDD') BETWEEN
                   To_Char(Status_Start_Dt, 'YYYYMMDD') AND
                   To_Char(Status_End_Dt, 'YYYYMMDD')
             GROUP BY Rpad(Integration_Id, 32)) AS Beg_Bal_Wkst_Num,
           (SELECT COUNT(DISTINCT(Rpad(Integration_Id, 32)))
              FROM Wc_Twfs_Olb_Invoice_History_f
             WHERE (Inv_Status_Code = 'NEW')
               AND To_Char((SYSDATE - 4), 'YYYYMMDD') BETWEEN
                   To_Char(Status_Start_Dt, 'YYYYMMDD') AND
                   To_Char(Status_End_Dt, 'YYYYMMDD')
             GROUP BY Rpad(Integration_Id, 32)) AS Wkst_Received_Num,
           (SELECT COUNT(DISTINCT(Rpad(Integration_Id, 32)))
              FROM Wc_Twfs_Olb_Invoice_History_f
             WHERE ((Inv_Status_Type = 'FIN' AND
                   Inv_Status_Code IN ('COMPLETE', 'PROCESSED')) OR
                   (Inv_Status_Type = 'WS' AND Inv_Status_Code IN ('PRC'))) --COMPLETED
               AND To_Char((SYSDATE - 4), 'YYYYMMDD') BETWEEN
                   To_Char((Status_Start_Dt), 'YYYYMMDD') AND
                   To_Char((Status_End_Dt), 'YYYYMMDD')
             GROUP BY Rpad(Integration_Id, 32)) AS Wkst_Processed_Num,
           (SELECT COUNT(DISTINCT(Rpad(Integration_Id, 32)))
              FROM Wc_Twfs_Olb_Invoice_History_f
             WHERE (Inv_Status_Type = 'FIN' AND Inv_Status_Code = 'CANCELLED')
               AND To_Char((SYSDATE - 4), 'YYYYMMDD') BETWEEN
                   To_Char((Status_Start_Dt), 'YYYYMMDD') AND
                   To_Char((Status_End_Dt), 'YYYYMMDD')
             GROUP BY Rpad(Integration_Id, 32)) AS Wkst_Canceled_Num,*/
           Duration AS Duration,
           Num_Days AS Num_Days,
           Num_Hours AS Num_Hours,
           Num_Minutes AS Num_Minutes,
           Num_Seconds AS Num_Seconds,
           Lead_Project_Office_Code AS Lead_Project_Office_Code,
           Lead_Project_Team_Code AS Lead_Project_Team_Code,
           Org_Id AS Org_Id,
           Trunc(SYSDATE - 1) AS Rpt_Date,
           To_Char((SYSDATE - 1), 'YYYYMMDD') AS Rpt_Date_Wid,
           --last_day(a.report_date) mth_end_dt,
           Loc_Curr_Code AS Local_Curr_Code,
           Usd_Exch_Rate AS Usd_Exch_Rate,
           Eur_Exch_Rate AS Eur_Exch_Rate,
           Gbp_Exch_Rate AS Gbp_Exch_Rate
      FROM Wc_Twfs_Olb_Invoice_History_f
    WHERE Rpt_Dt_Mcal_Period_Wid =
           (SELECT MAX(Rpt_Dt_Mcal_Period_Wid)
              FROM Wc_Twfs_Olb_Invoice_History_f)
    GROUP BY Beg_Bal_Wkst_Num,
              Wkst_Received_Num,
              Wkst_Processed_Num,
              Wkst_Canceled_Num,
              Duration,
              Num_Days,
              Num_Hours,
              Num_Minutes,
              Num_Seconds,
              Lead_Project_Office_Code,
              Lead_Project_Team_Code,
              Org_Id,
              Rpt_Date,
              Rpt_Date_Wid,
              Local_Curr_Code,
              Usd_Exch_Rate,
              Eur_Exch_Rate,
              Gbp_Exch_Rate;Edited by: 986006 on Mar 4, 2013 1:08 PM

  • Joining query with single row result

    dear all,
    i have two tables
    create table item(item_id number primary key,
    item_desc varchar2(200));
    create table item_properties(item_id number references item(item_id),
    property_name varchar2(20),
    property_value varchar2(100));i insert the following records
    insert into items values(1,'CPU');
    insert into item_properties values(1,'RAM','2gb');
    insert into item_properties values(1,'PROCESSOR','2ghz');
    insert into item_properties values(1,'HARDDISK','2ghz');
    commit;now i want a query which produce the following results
    item_id      RAM      PROCESSOR         HARDDISK
    1              2gb        2ghz              2TBHow to generate this result?
    i have create a query but it generate multiple rows, instead i need in a single row like above.
    select i.item_id,p.property_value from items i , item_properties p
    where i.item_id=p.item_id and i.item_id=1;Kind thanks.
    Edited by: Maahjoor on May 7, 2013 12:22 AM

    select i.item_id,
           max(decode(p.property_name,'RAM',p.property_value)) ram,
           max(decode(p.property_name,'PROCESSOR',p.property_value)) processor,
           max(decode(p.property_name,'HARDDISK',p.property_value)) hd
    from items i , item_properties p
    where i.item_id=p.item_id
    and i.item_id=1
    group by i.item_id;Or pivot in 11g
    with details as
    select i.item_id,p.property_name,p.property_value
    from item i , item_properties p
    where i.item_id=p.item_id
    and i.item_id=1
    select *
    from details
    pivot
       max(property_value) for property_name in ('RAM','PROCESSOR','HARDISK')
    );Edited by: jeneesh on May 7, 2013 1:04 PM

  • How to query on a single row form using only one page

    Hi APEX experts, I am just a beginner in apex and I face several problems on development. Despite that the forum helps me a lot and your answers to other people are valuable , I have stacked into something. Could you please someone tell me : if there is a way to define a single row form page based on table in which I could query and update without using a tabular page (to call the single row form). I want only to use only one page. Does APEX has this functionality? Thank you very much?

    I haven't tried it, but I am going to guess that yes it's possible (or if I were going to do this, this is what I'd try and I suspect it will work).
    If you take a moment and step back and look at what the wizard does when building a "form on a table with report", all it does is build two pages with page 1 (report overview with drill-down Edit button or link usually) calling page 2 (form) and setting the PK field on the page 2 form with an automated row fetch process and built-in DML processes. It's not that hard.
    Page 2 really doesn't care what the calling page was in order to query a single row; it just cares that ANY caller sets the primary key value for the ARF process to fetch a row. So I would just make page 2 call itself. This is what I'd do (and you might have to fine-tune little things that I might not have forseen but I think this will work).
    For the sake of example, let's say our table is PARTS and in it is a PART_ID, PART_NUMBER, PART_DESCRIPTION, PART_COST, etc. Assume PART_ID is the primary key and sequentially assigned by the DB in a trigger and is functionally meaningless to the user and is for PK purposes only. Let's assume PART_NUMBER is a unique key (although not the PK) by which the user will "know" a unique row (since the PK of PART_ID is more internal and not meaningful to the user). Assume PART_DESCRIPTION, PART_COST, etc. are just attributes.
    1. Use the wizard and build a "form on a table with report". This is just to get the handy dandy ARF process and DML processes, validations, etc. all generated for you. Let's assume the report page is Page 1 and the form is Page 2.
    2. When done, delete the report page entirely (so delete page 1).
    3. Edit the form page (page 2) and change any branch references from the nonexistent page 1 to now be page 2.
    Now here's the part where something has to set the internal P2_PART_ID field when page 2 is run. So why not set it from itself from something the user will uniquely enter?
    4. Create a P2_PART_NUMBER_FETCH item (text item is fine or if you want a LOV or whatever that's good too....whatever works. For clarity, you might even want to create a separate "search" or "query" region separate and above your existing form region to set this field apart visually so users know it's a search field. Source for this field should be "only when current value in session state is null".
    5. Created some sort of "GO" button to go along with the P2_PART_NUMBER_FETCH field.
    6. Make sure none of your existing post-submit processes fire when GO is pressed (edit all of the computations and validations and processes and ensure that they have conditions such that they do not fire when the submit value is "GO", so like a PL/SQL expression and set to v('REQUEST')<> 'GO').
    7. Add a new validation to your page that only fires when GO is pressed. Have it validate only when GO is pressed. Have it validate that P2_PART_NUMBER_FETCH is not null.
    8. Add a new PL/SQL process to your post-submit processing that only fires when GO is pressed. Have it look up to the database based on P2_PART_NUMBER_FETCH and get the PART_ID that corresponds to the part number the user entered and set the part number, something like this (even better for style and reusability if you embed this in a DB package function and call it):
    SELECT part_id
    INTO :P2_PART_ID
    FROM PARTS
    WHERE PART_NUMBER = :P2_PART_NUMBER_FETCH;
    9. Not sure if the branches that were generated will suffice for this (might need to add a new one...review what you have and see) but the bottom line is that the page should branch to itself (page 2) and not clear the cache.
    10. When the page repaints, since :P2_PART_ID is now populated in session state (again, page 2 should not care how it got populated...only should care that it did get populated by anything (including itself)), the automated row fetch (ARF) should fire and query up the row from the database for editing.

  • I need to print one query result as a single row

    Hi,
    I need to print one query result as a single row ,which gives more than one value (of subinventories)and also i would like to print the quantity of that particular subinventory at particular place.Please suggest how can i do this in the report builder?

    Actually I need to print inventory report with subinventory break up.For that all subinventories of category code AB are taken as single row.Based on that subinventory value Quantity must be printed at that particular place.
    For ex
    Quantity
    Item no Description Subinventory Code AB_Abc AB_Def AB_ghi
    1 ***** 12 9
    2 ****** 8 5
    like that.I am waiting for the reply.Plz its some how urgent.
    Thank you,

  • Getting different behaviour when query hits a single row?

    Hi
    I have a page where people type in search conditions and when they see the results (an ordinary tabluar report) they can click a certain row to assign the key of that row to a hidden field in my page.
    There's a requirement that if they're clever enough to hit a single matching row, then the key of that row is assigned to my hidden item without them having to go through the stress and hard work related to clicking a link :-)
    So I'll probably make a process that tests to see if their search returns a single row and only do the report if not. But that means performing the resulting SQL twice when there's more than one row.
    Is there a way to have the number of rows returned by the SQL source for a report affect the behaviour of the page? AFAIK the #TOTAL_ROWS# etc. are only applicable in the header & footer of the report region, so I guess there's no way to do what I imagined?
    Jakob

    You could query your rows into a collection and determine the number of records in the collection. Check out the HTMLDB_COLLECTION (APEX_COLLECTION) API section in the HTML DB (APEX) documentation.
    Your multiple record region where they select their row could then be based on:
    SELECT * FROM HTMLDB_COLLECTION WHERE collection_name = 'my collection'
    Mike

  • Splitting  single row to multiple query result

    Hi All,
    I have a column is a table with data seperated by new like . I need to write a select query which can split this to multiple rows .. can any one help me out .
    please see the xample
    select data_comm from customer where rownum=1
    data_comm
    serial=0
    parallel=1
    comm=1
    a single row contain a field called data_comm which has got data stored seperated by new_line
    I need to write a query which can split data on data_comm and give as multiple rows.
    Thanks in advance

    I think something like this would do the trick.
    Part 1:
    select substr(data_comm, 1, instr(data_comm,chr(10),1)) from customer ;
    Part 2:
    select substr(data_comm,instr(data_comm,chr(10),1)+1,instr(data_comm,chr(10),2)) from customer ;
    Part 3:
    select substr(data_comm,instr(data_comm,chr(10),2)+1,instr(data_comm,chr(10),3)) from customer ;
    Maybe the chr(10) is not the used newline char, but you can figure that one out yourself

  • SQL Query Single Row not working

    My workflow contain a Query Single row activity. I have added a where clause in Arabic which is not working. If I remove the Arabic condition its working.
    Is there something to do with the server?
    My server is windows 2008 R2 Server.
    The same workflow is running perfectly on another identical environment.
    Thanks for any valuable suggestions,
    Nith

    Hi Sastry,
    Connection to the database is trough Pivotal, I have tried ODBC connection as well but same error
    The instruction at "0x005d53e0" refereced memory at "0x00000014'. The memory could not be "read".
    With ODBC I have always compilation error saying
    Query Engine Error: '42000:[Microsoft][ODBC SQL Server Driver][SQL server] Incorrect syntax near the keyword 'SELECT'. '.
    but even the simple select statment is showing the error.
    Do you think the error is with Drivers???
    Regards
    Stefan

  • Single row query and convert

    greetings,
    Data tables and intended output are on the bottom.
    Process tables contains different store id that process the fabric. 1 single order will have 2 ( at most) or 1 different process store(s). Need to create a query list out all order no along with process store names , work. It also requires to convert each numeric fieldto 0 if null. I was able to create a query as the following but stuck on don't knwo how to make the order number listed as single row plus that numeric field conversion when there are 2 different process no . Can you help ? I know there are many gurus out here that can give me a lift. Thanks.
    select
    B.porderno,
    decode(pprocessno,1,A.name,null) as "1st storename",
    decode(pprocessno,2,A.name,null) as "2nd storename",
    decode(pprocessno,1,nvl(B.plength,0),null) as "1st length",
    decode(pprocessno,2,nvl(B.plength,0),null) as "2nd length"
    from test_store2 A,test_process B
    where A.storeid=B.pstoreid.....
    CREATE TABLE test_store2
    ( storeid NUMBER(3,0) not null,
    name VARCHAR2(20)not null,
    addr VARCHAR2(30)not null
    CREATE TABLE test_process
    ( porderno NUMBER(10,0) not null,
    pstoreid number(3,0) not null,
    pprocessno number(3,0) not null,
    plength number(3,0),
    pwork VARCHAR2(30)
    INSERT INTO test_store2(storeid, name, addr)
    VALUES (001, 'papas', '123 Road1')
    INSERT INTO test_store2(storeid, name, addr)
    VALUES (002, 'tcbi', '652 heaven st')
    INSERT INTO test_store2(storeid, name, addr)
    VALUES (003, 'tutu club', '888 big ave')
    INSERT INTO test_store2(storeid, name, addr)
    VALUES (004, 'stinkys', '432 bobo st')
    INSERT INTO test_process(porderno, pstoreid,pprocessno,plength, pwork)
    VALUES (811, 2,1,null,'prepNdye')
    INSERT INTO test_process(porderno, pstoreid,pprocessno,plength, pwork)
    VALUES (811, 1,2,30,'trimming')
    INSERT INTO test_process(porderno, pstoreid,pprocessno,plength, pwork)
    VALUES (812, 1,1,10,'dye')
    INSERT INTO test_process(porderno, pstoreid,pprocessno,plength, pwork)
    VALUES (813, 3,1,40, 'prep')
    INSERT INTO test_process(porderno, pstoreid,pprocessno,plength, pwork)
    VALUES (813, 4,2,null, 'dye')
    look for result layout
    order  1st storename 2nd storename      1st length    2ndlength         1stwork            2nd work
    811     tcbi                papas             0             30            prepNdye           trimming
    812     papas                                 10             0            dye
    813     tutu club           stinks            40             0            prep               dye

    Hi,
    Please don't post unformatted code. If you want people to read you code, don't make it difficult for them
    When posting formatted text on this site, type these 6 characters:
    &#123;code&#125;
    (small letters only, inside curly brackets) before and after sections of formatted text, to preserve spacing.
    In the query I posted,
    AND     p2.pprocessno     = 2was part of the outer-join condition between p1 and (the optional) p2.
    When using -notation, you need a sign after all references to columns from the table that could be missing (p2 in this case), so you should have siad:
    where     (       p1.pstoreid   = s1.storeid
         and       p1.pprocessno = 1
    and      (     p1.porderno       = p2.porderno (+)
         AND     p2.pprocessno (+) = 2              -- (+) sign needed here
    and     (p2.pstoreid     = s2.storeid (+)         -- Cascading outer join
         )A rule of thumb: if any WHERE-clause reference to p2 has a -sign, then all references to p2 must have a -sign, otherwise the effect will be an inner join. There is one exception, a cascading outer join , where a another table (s2 in this case) is outer-joined to the optional table (p2). You can't have -signs on both sides of a condition.  In a cascading outer join, only the distal+ table (the one farther removed from the required table, p1 in this case) is marked with a +-sign.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Need query to convert Single Row Multiple Columns To Multiple rows

    Hi,
    I have a table with single row like below
    Column0 | Column1 | Column2 | Column3 | Column4|
    Value0    | Value1    | Value2    | Value3    |  Value4  |
    Am looking for a query to convert above table data to multiple rows having column name and its value in each row as shown below
    Column0 | Value0
    Column1 | Value1
    Column2 | Value2
    Column3 | Value3
    Column4 | Value4
    Thanks in advance.
    Mohan

    Hi ykMohan,
    Dynamic UNPIVOT can be applied in this case as well.
    CREATE TABLE dbo.T(ID INT,Column0 VARCHAR(99),Column1 VARCHAR(99),Column2 VARCHAR(99),Column3 VARCHAR(99),Column4 VARCHAR(99))
    INSERT INTO T VALUES
    (1,'Value0','Value1','Value2','Value3','Value4'),
    (2,'Value0','Value1','Value2','Value3','Value4');
    DECLARE @columns VARCHAR(MAX)
    SELECT @columns=
    STUFF(
    SELECT ','+ COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME ='T' AND TABLE_SCHEMA='dbo' AND Column_name NOT IN('ID') FOR XML PATH('')
    ),1,1,'')
    DECLARE @Sql NVARCHAR(MAX)
    SET @Sql =
    'SELECT ID, UPT.col,UPT.val FROM T
    UNPIVOT
    (val FOR col IN('+@columns+')) AS UPT'
    EXEC sp_executeSQL @Sql
    DROP TABLE T
    If you have any feedback on our support, you can click
    here.
    Eric Zhang
    TechNet Community Support

  • Query - Purchasing information in single row

    Hi Experts,
    I have a requirement to create a report which shows products with all POs in a single row.    In many cases we will have several open PO at one time for the same product.   For example - item SUFF2231-M will have:
    PO
    Qty
    Due Date
    42771
    200
    10/05/2014
    42883
    250
    20/05/2014
    43321
    150
    30/05/2014
    43375
    100
    10/06/2014
    43401
    100
    20/06/2014
    We only need to see up to 5 PO for each product.   Ideally I need to be read them on a single line like so:
    ItemCode
    PO1
    Qty1
    DueDate1
    PO2
    Qty2
    DueDate2
    PO3
    Qty3
    DueDate3
    PO4
    Qty4
    DueDate4
    PO5
    Qty5
    DueDate5
    SUFF2231-M
    42771
    200
    10/05/2014
    42883
    250
    20/05/2014
    43321
    150
    30/05/2014
    43375
    100
    10/06/2014
    43401
    100
    20/06/2014
    Is this possibe using only SQL query?
    Regards
    Geoff

    Hi Geoff,
    You can use the ROW_NUMBER and CASE Functions to acheive this. Here with , i have give u a small idea with an ex:
    Qry :
    B.ItemCode,SUM(B.PO1)[PO1],SUM(B.POQty1)[POQty1],SUM(B.PO2)[PO2],SUM(B.POQty2)[POQty2] From
    select Itemcode
    CASE when Sno=1 Then DocNum End [PO1]
    CASE When Sno=1 Then Qty End [POQty1]
    CASE when Sno=2 Then DocNum End [PO2]
    CASE When Sno=2 Then Qty End [POQty2]
    From(
    Row_Number() Over (Order By Opor.Docnum) [Sno], Opor.DocNum,POr1.ItemCode,sum(POr1.Quantity)[Qty] from OPOR join Por1 on Opor.DocEntry=por1.DocEntry
    ItemCode='20002' group by oPor.DocNum,por1.ItemCode
    A where A.Sno<=2)B Group By B.ItemCode
    Result :-
    ItemCode  PO1         POQty1           PO2            POQty2
    20002       18            1.000000         19                10.000000
    Thanks,
    Karthikeyan.P

  • Single row from this query without create a group by

    Can I have a single row from this query without create a group by on tipo (TIPO can have only 2 value (A,D)
    SELECT
    CASE TIPO
    WHEN 'D' THEN SUM(IMPORTO) ELSE 0 END DIMPORTO,
    CASE TIPO
    WHEN 'A' THEN SUM(IMPORTO) ELSE 0 END AIMPORTO
    FROM MGIORNALE
    WHERE K_CONTO = '100001' --CONTO
    AND DECODE(T_MOVIM,'MRAP',TO_DATE('31/12/'||to_char(a_competenza),'DD/MM/YYYY'),DATA_RG)
    -- BETWEEN DATAA AND DATAB
    BETWEEN '01/01/2006' AND '31/12/2006'
    --GROUP BY TIPO
    --AND TIPO = COL_conto
    Thanks in advance

    Is like this?
    sum (CASE TIPO
    WHEN 'D' THEN IMPORTO ELSE 0 END) DIMPORTO,

Maybe you are looking for

  • Report Engine not intiated.

    Hi all, I am getting below errro when i am trying to refresh the report oftenly means once per day "the reprot engine not intiated ". please suggest me any way to avoid it..

  • Could not open the file in application server

    Hi All, I have a Zreport which will write files on application server. When I tried to download it is showing me "Could not open the file". And when checked again with /nal11 the files does not exist. When I ran the Zreport again the file exist in ap

  • In need of help badly (Pioneer Head Unit)

    Hi All, Recently got an AVIC-D3 head unit and a CD-I200 ipod cable with a 160 GB Ipod classic. I've been experiencing something weird - when listening to music it will eventually freeze the track title and duration display - ie :50/3:00 or whatever t

  • Issue with Characters (tilde, accent and more)

    Hello all, Im triyng to do and export / import Export system: AIX 4.x, Oracle, 8.1.7 Import system RedHat 5, Oracle 10.0.2 After trying a lot with different character sets, setting and unsetting nls_lang in the target system i still having problems.

  • Nokia c5- receiving speaker(ear piece) has low vol...

    Y nokia is not increasing ear piece (receiving) volume??? Its almost an year I bought c5, only trouble I have is receiving volume is very low, if it is in traffic I can't hear any thing. I waited for June software update thinkin dis prob will b solve