Ignore empty rows

I have the following table structure
AccountTable
...accountID
...RegionID
...CategoryID
...subtypeID
CategoryTable
...CategoryID
...accountID
RegionTable
...RegionID
...accountID
SubtypeTable
...SubtypeID
...accountID
I want to form a query which will select all accounts belonging to a category,region & subtype(all AND).suppose if any of this table doesnt have data then the query should ignore that table and get data for the other two conditions. is there any way to do that in PL/SQL??(no procedures/functions)

Hi,
My problem is a bit different. in the tables i've included the wrong attribute.
CategoryTable
categoryID
criteriaID
RegionTable
regionID
criteriaID
I want to get all the accounts belonging to particular category/region with a particular criteria ID(All AND).so i have to have a query like
select accountID from accountstable acc where
acc.regionID in (select regionID from regiontable where criteriaID = 34)
and
acc.categoryID in (select categoryID from categorytable where criteriaID = 34)
but the problem is if any one of category/region is not having record it wont get me rows for the other condition
I cameup with a solution like this
select accountID from accountstable acc where
acc.regionID in (select regionID from regiontable where criteriaID = 34)
or
(select count(regionID) from regiontable where criteriaID = 34) = 0)
and
acc.categoryID in
select categoryID from categorytable where criteriaID = 34)
or
(select count(categoryID ) from categorytable where criteriaID = 34) = 0)
This works fine as it negates the condition when no row is found. the pblm is it is taking more time
any suggestion??

Similar Messages

  • Ignore empty rows at end

    I have a csv file, which has empty lines at the end.
    My controlfile has a default sequence, due to which it is uploading all the empty lines at the end.
    How can i tell sql*loader to ignore these lines ?
    load data append into table Test_Data_staging
    fields terminated by "," optionally enclosed by '"' trailing nullcols          
    SERIAL_NUMBER SEQUENCE(COUNT,1),
    TEST_DATA_VERSION,
    ENVIRONMENT,
    TEST_DATA_OWNER
    )

    Hi,
    you can add a when clause (WHEN firstcolumn != BLANKS), here is an example:
    LOAD DATA
    INFILE 'C:\Temp\Book1.csv'
    BADFILE 'C:\Temp\Book1.bad'
    DISCARDFILE 'C:\Temp\Book1.dsc'
    TRUNCATE
    INTO TABLE "XTEST"
    WHEN (col1 != BLANKS)
    FIELDS TERMINATED BY ','
    OPTIONALLY ENCLOSED BY '"' AND '"'
    TRAILING NULLCOLS
    (COL1,
    COL2,
    COL3)or if you want:
    LOAD DATA APPEND INTO TABLE TEST_DATA_STAGING
    WHEN (TEST_DATA_VERSION != BLANKS)
    FIELDS TERMINATED BY ","
    OPTIONALLY ENCLOSED BY '"'
    TRAILING NULLCOLS
    SERIAL_NUMBER SEQUENCE(COUNT,1),
    TEST_DATA_VERSION,
    ENVIRONMENT,
    TEST_DATA_OWNER
    {code}
    Edited by: user11268895 on Aug 30, 2010 1:56 PM
    Edited by: user11268895 on Aug 30, 2010 1:56 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Supress empty rows !

    Hi,
    How to supress empty rows?
    i want to supress the rows in a report that does not have a value. i wish to display only those recors which has some value.
    I have tried using Supress = Y under expansion, nothing happened.
    any ideas ?
    Regards

    Hi ,
    If you are creating an EVDRE report and if you want to ignore the rows with zero values then you can use 'Y'.
    Please check if your report says  EVDRE=OK on the left top corner of excel to see if syntax is correct
    you can use this expansion rows under SUPPRESS as mentioned by you.
    SUPPRESS=Y
    Please let us know . thanks.
    Sanjeev

  • How can I create an empty row on a #TempTable based on an input parameter

    So if my Line of Business is 'MC' or 'MG', I have to go over to Oracle and get its data accordingly. Then, when I create my final report result set, I think I'll want to UNION in that result set if my Parameter is 'MC' or 'MG'. I don't think I can UNION
    based on the value of the Parameter. So my thought process was to create an empty row on my #TempTable so when I UNION and my parameter is NOT 'MC' or 'MG' then it will have nothing to UNION in. My struggle is how do I create an empty row in my #TempTable
    if my parameter is NOT 'MC' or 'MG'
    If I am wwwaaayyy off here, please tell me so.
    This is my #TempTable Creation SQL...
    IF EXISTS
    (SELECT 1
    FROM [#TempTable_LineOfBusiness_Parameter]
    WHERE [#TempTable_LineOfBusiness_Parameter].[RESULT] IN ('MC','MG'))
    BEGIN
    SELECT *
    INTO [#TempTable_Market_Prominence_Member_Data]
    FROM OPENQUERY
    (RPDMHF,
    'SELECT HCFA_NAME_ORG.NAME_ID,
    HCFA_NAME_ORG.MEMBER_ID,
    HCFA_NAME_ORG.HIC_NUMBER,
    MEMBER.NAME_FIRST,
    MEMBER.NAME_LAST,
    HCFA_DATE.START_DATE,
    HCFA_DATE.END_DATE,
    HCFA_NAME_ORG.COUNTY_CODE,
    HCFA_NAME_ORG.PART_A_PAYMENT,
    HCFA_NAME_ORG.PART_B_PAYMENT,
    HCFA_NAME_ORG.STATUS,
    HCFA_NAME_ORG.ORG_ID,
    HCFA_NAME_ORG.PLAN,
    HCFA_NAME_ORG.ENROLL_DATE,
    HCFA_NAME_ORG.PBP_ID,
    HCFA_DATE.VALUE
    FROM SC_BASE.HCFA_DATE
    LEFT JOIN SC_BASE.HCFA_NAME_ORG
    ON HCFA_NAME_ORG.NAME_ID = HCFA_DATE.NAME_ID
    LEFT JOIN AMIOWN.MEMBER
    ON TRIM(MEMBER.MEMBER_NBR) = TRIM(HCFA_NAME_ORG.MEMBER_ID)
    WHERE HCFA_DATE.INDICATOR = ''plan''
    AND HCFA_DATE.START_DATE >= ''2015-01-01''
    END
    If I add an ELSE, it always comes back and tells me the #TempTable_Market_Prominence_Member_Data already exists. As if it's creating it regardless of the Top IF.
    Thanks for your review and am hopeful for a reply.

    Hi ITBobbyP,
    The error came back from your ELSE Statement most probably caused by the reason mentioned in Hoffmann's post.
    Regarding your requirement, I would suggest you CREATE the [#TempTable_Market_Prominence_Member_Data] explicitly.
    CREATE TABLE [#TempTable_Market_Prominence_Member_Data]
    NAME_ID INT,
    MEMBER_ID INT,
    HIC_NUMBER VARCHAR(99),
    NAME_FIRST VARCHAR(99),
    NAME_LAST VARCHAR(99),
    START_DATE DATE,
    END_DATE DATE,
    COUNTY_CODE VARCHAR(99),
    PART_A_PAYMENT MONEY,
    PART_B_PAYMENT MONEY,
    STATUS VARCHAR(99),
    ORG_ID INT,
    PALN VARCHAR(99),
    ENROLL_DATE VARCHAR(99),
    PBP_ID INT,
    VALUE INT
    IF EXISTS
    (SELECT 1
    FROM [#TempTable_LineOfBusiness_Parameter]
    WHERE [#TempTable_LineOfBusiness_Parameter].[RESULT] IN ('MC','MG'))
    BEGIN
    INSERT INTO [#TempTable_Market_Prominence_Member_Data]
    SELECT *
    FROM OPENQUERY
    (RPDMHF,
    'SELECT HCFA_NAME_ORG.NAME_ID,
    HCFA_NAME_ORG.MEMBER_ID,
    HCFA_NAME_ORG.HIC_NUMBER,
    MEMBER.NAME_FIRST,
    MEMBER.NAME_LAST,
    HCFA_DATE.START_DATE,
    HCFA_DATE.END_DATE,
    HCFA_NAME_ORG.COUNTY_CODE,
    HCFA_NAME_ORG.PART_A_PAYMENT,
    HCFA_NAME_ORG.PART_B_PAYMENT,
    HCFA_NAME_ORG.STATUS,
    HCFA_NAME_ORG.ORG_ID,
    HCFA_NAME_ORG.PLAN,
    HCFA_NAME_ORG.ENROLL_DATE,
    HCFA_NAME_ORG.PBP_ID,
    HCFA_DATE.VALUE
    FROM SC_BASE.HCFA_DATE
    LEFT JOIN SC_BASE.HCFA_NAME_ORG
    ON HCFA_NAME_ORG.NAME_ID = HCFA_DATE.NAME_ID
    LEFT JOIN AMIOWN.MEMBER
    ON TRIM(MEMBER.MEMBER_NBR) = TRIM(HCFA_NAME_ORG.MEMBER_ID)
    WHERE HCFA_DATE.INDICATOR = ''plan''
    AND HCFA_DATE.START_DATE >= ''2015-01-01''
    END
    Explicitly creating the temp table will offer below benefit in this case.
    The ELSE statement is no longer needed, if the no rows get inserted into that table, it has nothing to union an empty table.
    With the column datatype defined, you can avoid such conversion error
    SELECT NULL AS COL1,NULL AS COL2 INTO #T
    SELECT COL1,COL2 FROM #T
    UNION
    SELECT 1,'ABC'--Conversion failed when converting the varchar value 'ABC' to data type int.
    If you have any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • How to delete empty row without validation error in ADF Table(EMP)

    Hi Everyone,
    I am using EMP Table in ADF jspx page to insert the data into database.when i insert a row into table by createInsert operation,it inserting the row.But I need to delete that row immediately with out entering any value.
    But it showing some validation error at empno.Is there any ways to delete the empty row?if not,what are the reasons that we can't delete the row.
    could any one tell me the reasons!!
    Thanks in advance!!
    With Best Regards,
    Amar
    Edited by: 973755 on Dec 11, 2012 6:42 AM

    Amar,
    I am little confused with your logic here.....
    but if you are trying to remove the row by clicking Remove button, you can set the immediate property to true and that remove function will run without executing any entity validation.......
    -R

  • How to insert an empty row on a matrix with multiple loaded lines?

    Hi.
    I want to insert an empty row on my form's matrix. Currently I am using the <b>AddRow </b>method, as it is:
    // C# - it's mandatory to give parameters to the method (=
    oMatrix.AddRow(1,1)
    But, when the matrix already has some rows (at least 1), the method <b>AddRow </b>inserts the new line as a copy of above line, then, I have to manually clear all cells.
    Any idea on this?
    Thanks in advance.

    If you matrix is bound to a dbDatasource you can insert a record in the dbdataspurce instead of using matrix.AddRow... If not only way to do it is by clearing the row after add

  • How can I leave an empty row?

    Hi,
    If I want to use GridBagLayout, how can I leave an empty row? Or empty column? When I create the buttons on a frame, are they created sequentially? so Is that mean I can't put something back to the first row later in the program? Thx.
    Adrian

    I'm just guessing, since I havent done Java for a long time... but if you want an empty row... what pops up in my mind first is like putting in an empty JLabel/Label... for that row... but then if you wanna fill it in... i dunno...

  • Query against materialized view from stored procedure brings back empty row

    I have a stored procedure that runs a query against a materialized view. When I run the query outside the SP it works just fine. When I change the MV to a table name, the SP works. When I change it back to the MV i get an empty row. Any ideas? The code is below:
    PROCEDURE getAuth     (p_naid        IN  NUMBER,
                             p_scope       IN VARCHAR2,
                             o_xml_data    OUT SYS_REFCURSOR
                             ) IS
      BEGIN
        IF p_scope = 'Approved' THEN
          OPEN o_xml_data FOR
            SELECT naid,
                   p_naid,
                   auth_type,
                   xml_data
            FROM some_mv
            WHERE naid = p_naid;   
          RETURN;
          CLOSE o_xml_data;
    ... the rest of the procedure ...

    does procedure contain EXCEPTION handler?
    if so, then remove, delete & eliminate EXCEPTION handler (at least during testing & debugging)

  • SSRS- Hide Empty Rows

    Hi,
    I am having a difficult time deleting empty rows in a table. I used HideDuplicates under properties to hide any of the duplicated data but now it is leaving me an empty row in the table. I tried to use the following codes but none of them seemed to work:
    =Iif(Previous(Fields!Apps.Value) = Fields!Apps.Value, True, False)
    =IIF(fields!Apps.value IS NOTHING, True, False)
    =isnothing(fields!Apps.value)
    =if(Fields!Apps.Value = "",
    true, false). 
    =IIF(IsNothing(Fields!Apps.Value),True,False)
    =iif(Fields!Apps.IsMissing,True,False) 
    Might anyone know another code I might use to delete the empty rows?
    Thank you in advance!

    What you are looking for is probably the Visibility option not the HideDuplicates. You can right click on the row and choose
    Row Visibility. Select "Show or hide based on an expression" and put in the expression that resolves to true to hide the row, and false to show it.
    The HideDuplicates field that you are using is there to hide duplicating text and not entire rows. For example if you have:
    Value1
    5
    Value1
    15
    Value1
    20
    Value2
    10
    You would then get:
    Value1
    5
    15
    20
    Value2
    10
    I hope that helped.
    Regards,
    Andrew.

  • Appending empty rows in internal table

    Hi,
      i am using table control, where there is a condition, some row may left empty. end if i press enter button the empty row is filled by the next available record. My need is to pick the records in the table control to the internal table including the empty rows as it is.

    Hi Karthikeyan,
    By default with user pressinng enter, empty rows will get deleted.
    How are you populating your table control? Is it from standard transaction or your internal table?
    If it is from your internal table, you can add anothe flag field for empty row.
    Whenever row is empty in your internal table, mark flag field as 'X', so in the table control you these entries will not get vanished with pressing of enter.
    This is one idea and you can build on this. You can make this flag column as non editable so that no one can change these.
    hope this helps,
    ags.

  • How to add empty rows in table in smart form

    how to add empty rows in table in smart form?
    plz help me regarding this
    send me ur queries to [email protected]

    You will need to add some extra rows to the internal table that your table is displaying.  Use a program node to append additional rows with a key but no argument.
    Alternaively a template may me more suitable for your requirement than a table.
    Finally, please do not include you e-mail address in your question.  Your question and the answers provided to it are for the benefit of everyone in the Community.
    Regards,
    Nick

  • Button to delete all empty rows

    I am in the process of creating an interactive form that has a button that add rows for the user to input issues and another button to add follow-ups to those instances. There are 3 different sets of these. However, we do not want to add a delete button to all rows, to allow for accidental deletion of already inputted data.  I would like to create a button that will delete all empty rows, including all subforms.  Either that, or upon saving the document, all empty rows would be deleted - whichever would be easier. Please help!  This seems like it will be a complicated task and I am not that well versed in LiveCycle to be able to figure this out on my own.
    Thank you!

    There is no doubt that looping through nested repeating objects is more complex:
    Here is the script for the first table with follow-up rows:
    // Technical
    var nCount3 = VitalsSubform.Technical._Instance1.count;
    for (var k=0; k<nCount3; k++)
         // this is script to remove the follow-up rows in the first table only
         var nCount6 = xfa.resolveNode("VitalsSubform.Technical.Instance1[" + k + "]").Table1._Row1.count;
         // loop through the rows in the follow-up table
         for (var i=0; i<nCount6; i++)
              if (xfa.resolveNode("VitalsSubform.Technical.Instance1[" + k + "].Table1.Row1[" + i + "]").Cell4.rawValue == null)
                   // remove null row
                   xfa.resolveNode("VitalsSubform.Technical.Instance1[" + k + "]").Table1._Row1.removeInstance(i);
                   // recount nCount in case a row has been deleted
                   nCount6 =xfa.resolveNode("VitalsSubform.Technical.Instance1[" + k + "]").Table1._Row1.count;
                   // account for the row that is now deleted
                   i = i-1;
         // now remove null statements
         if (xfa.resolveNode("VitalsSubform.Technical.Instance1[" + k + "]").Table1.Statement.Statement.rawValue == null)
              VitalsSubform.Technical._Instance1.removeInstance(k);
              var nCount3 = VitalsSubform.Technical._Instance1.count;
              k = k-1;
    It is by no means tested and could still be flaky.
    Have you considered a manual 'x'/delete button for the follow-up rows?
    Here is the form: https://acrobat.com/#d=JMGUKXNQ*qMD18S3W5VxSQ
    Niall

  • How to avoid displaying empty rows in a table?

    The situation is as follows:
    I have got a set of questions under a particular category say marketing category.
    The user will be displayed with a table consisting of a set of questions from a particular category with four radio buttons for each question.
    Now once he is done with all the set of questions under a particular category, he will be navigated to the next set of questions under some other category say 'xyz'
    Now instead of creating seperate view objects for each category, we have created a view object which will hold all the set of questions from all the category but will display only the set of questions under a particular category by declaring a variable in the backing bean and setting the question rendering to the value in the variable. the value to the variable will be changed once the user is done with answering all the set of questions under a particular category.
    Now the problem that i am facing is:
    Because of the rendering condition that i have used, it displays only those rows that have the rendering condition set to the variable in the backing and displays all other empty rows overlapped.
    How do i avoid this situation ??

    Seems odd, but you could use COALESCE to achieve this.
    ME_XE?create table all_nullz (col1 number, col2 number, col3 number);
    Table created.
    Elapsed: 00:00:00.20
    ME_XE?
    ME_XE?insert into all_nullz values (1,2,3);
    1 row created.
    Elapsed: 00:00:00.12
    ME_XE?insert into all_nullz values (null, null, null);
    1 row created.
    Elapsed: 00:00:00.06
    ME_XE?
    ME_XE?delete from all_nullz where coalesce(col1,col2,col3) is null;
    1 row deleted.
    Elapsed: 00:00:00.26
    ME_XE?

  • Preventing empty rows in address formats

    Hallo everyone!
    I'd like to know if there is a method to prevent SBO2005A from printing empty rows in the address fields when for instance there is missing county in BP addresses like this:
    I have defined an address format that goes
    Block
    County
    Street
    ZipCode | Freetext(" ") | City
    We use Block as "Name2" and County as "Name3" in master data just in case the customer wants to use additional names for his BPs.
    If I use the "Block" - field and I leave the "County" - field blank it prints an empty row between "Block" and "Street". This is not the behaviour I would like to see. In case "county" is missing I would rather see something like this in a printout:
    Block
    Street
    ZipCode | Freetext(" ") | City
    So, is there a method to force this? or any workaround?

    Hello Patryk,
    PLD does not offer the functionality to control the blank lines in an address field.  I would suggest you use a formatted search in your address field on the marketing document and have it formatted in the document itself before you print.
    Please see sample code for your requirment for the Ship to address.  If you want this to applied to the Bill to address field then you have to slight alter the query by cha
    For Shipto address formatting
    SELECT CASE WHEN T0.Block IS NOT NULL THEN + CHAR(13) + CHAR(10) + T0.Block + CHAR(13) + CHAR(10) ELSE '' END +
    CASE WHEN T0.County IS NOT NULL THEN + CHAR(13) + CHAR(10) + T0.County + CHAR(13) + CHAR(10) ELSE '' END +
    ISNULL(T0.Street, '') + CHAR(13) + CHAR(10) + ISNULL(T0.ZipCode, '') + '  ' + ISNULL(T0.City, '')
    FROM  [dbo].[CRD1] T0 WHERE T0.AdresType = 'S' AND T0.Address = $[$40.0.0] AND T0.CardCode = $[$4.0.0]
    For Billto address formatting
    SELECT CASE WHEN T0.Block IS NOT NULL THEN + CHAR(13) + CHAR(10) + T0.Block + CHAR(13) + CHAR(10) ELSE '' END +
    CASE WHEN T0.County IS NOT NULL THEN + CHAR(13) + CHAR(10) + T0.County + CHAR(13) + CHAR(10) ELSE '' END +
    ISNULL(T0.Street, '') + CHAR(13) + CHAR(10) + ISNULL(T0.ZipCode, '') + '  ' + ISNULL(T0.City, '')
    FROM  [dbo].[CRD1] T0 WHERE T0.AdresType = 'B' AND T0.Address = $[$226.0.0] AND T0.CardCode = $[$4.0.0]
    Suda

  • How to ignore 1st row form the file(csv) sender CC

    Hi,
    I have a CSV File (File sender) that I need to load with PI.I want to Ignore 1st row from the file.
    For example the File contains 10 rows  but PI  need to read  the data from 2nd row.
    because in the 1st row contains header data like name, number, mobile, address, etc., I don't want to read this 1st row. I want to read only the data which starts from the 2nd row.
    can you pls tell me the ignore command File Receiver CC
    I am using these commands.
    Record structure: item,*
    item.fieldSeparator: ,
    item.endSeparator : 'nl'
    item.fieldNames:   Name, Number, Address, Mobile
    Thanks in Adv
    Vankadoath

    Hi Vankadoath,
    In your content conversion use the field document offset which ignores the number of lines to be ignored.
    for example if you provide the value as "1" for document offset it will ignore the first line in your file.
    (Under Document Offset, specify the number of lines that are to be ignored at the beginning of the document.
    This enables you to skip comment lines or column names during processing.
    Regards,
    Naveen.

Maybe you are looking for

  • Only starts up in Windows Vista does not start in Tiger

    I've got a Macbook Black running on Tiger and I've also got Windows Vista running thru boot camp. Last night I was running Tiger fine. I did get a msg telling me my startup disk was almost full. I didn't have the time to delete some files to make spa

  • How to get a "com.sap.tc.webdynpro.progmodel.api.IWDView" object

    hi,everybody,      As we all know, there is a com.sap.tc.webdynpro.progmodel.api.IWDView object in wdDoModifyView() parameters.We can use the IWDView object in the method or after the method.But in my project, I want to use the IWDView object before

  • Tnsnames.ora file unable to edit in my Laptop

    hi, I have installed Oracle 10g on my personal laptop. It worked fine on the day I installed. Now I get tnsconnect timeout occured. I searched the tnsnames.ora file and could not modify the file. # tnsnames.ora Network Configuration File: D:\oracle\p

  • ESS Claims workflow ws18900023

    Dear friends, Need steps to trigger WS18900023.config part done.is there any standard class for it.standard task 18900010 added in swfvisu. Thanks in advance.

  • Do older HP Laserjets work with Leopard?

    I have an old Laserjet 5MP, which I adore. It works great and shows no signs of dying anytime soon. I've read of all the Leopard printer issues with trepidation... I would like to upgrade, but I sure as heck don't want to buy a new printer! Does anyo