How do I create a folder or report from a query with a union and parameters

I have created folders with unions but I am having difficulty coverting a query with a union and parameters.
The following works great in SQL*Developer without parameters, but I want to change to use parameters for the year and quarter and use it in Discoverer:
SELECT TO_CHAR(NVL(AV.TAX_ID,999999999),'000000000') FEID,
  AV.FIRM_NAME VENDOR_NAME,
  AV.BIDCLASS CONTRACT_CODES,
  AV.AWAMT AWARD_AMOUNT,
  AV.SOL_MODE FORMAL_INFORMAL,
  AV.CERT BUSINESS_ENTITY,
  AV.ETHNICITY ETHNICTY,
  AV.PO_NUMBER_FORMAT CONTRACT,
  SUM(VP.INVOICE_AMOUNT) AMOUNT_PAID_$
FROM CONFIRM.VSTATE_PAID_AWARD_VENDORS AV,
  CONFIRM.VSTATE_VENDOR_PAYMENTS VP
WHERE ( ( AV.PO_NUMBER = VP.PO_NUMBER
AND AV.VENDOR_ID       = VP.VENDOR_ID ) )
AND (TO_CHAR(VP.PAYMENT_DATE,'Q') = '4')
AND ( TO_CHAR(VP.PAYMENT_DATE,'YYYY') = '2009' )
GROUP BY TO_CHAR(NVL(AV.TAX_ID,999999999),'000000000'),
  AV.FIRM_NAME,
  AV.BIDCLASS,
  AV.AWAMT,
  AV.SOL_MODE,
  AV.CERT,
  AV.ETHNICITY,
  AV.PO_NUMBER_FORMAT
  union
SELECT TO_CHAR(NVL(AV2.TAX_ID,999999999),'000000000') FEID,
  AV2.FIRM_NAME VENDOR_NAME,
  AV2.BIDCLASS CONTRACT_CODES,
  AV2.AWAMT AWARD_AMOUNT,
  AV2.SOL_MODE FORMAL_INFORMAL,
  AV2.CERT BUSINESS_ENTITY,
  AV2.ETHNICITY ETHNICTY,
  AV2.PO_NUMBER_FORMAT CONTRACT,
  0 AMOUNT_PAID_$
FROM CONFIRM.VSTATE_PAID_AWARD_VENDORS AV2
WHERE
not exists (SELECT 'X'
              FROM CONFIRM.VSTATE_VENDOR_PAYMENTS VP2
             WHERE av2.po_number = vp2.po_number
                   AND (TO_CHAR(VP2.PAYMENT_DATE,'Q') = '4')
                   AND ( TO_CHAR(VP2.PAYMENT_DATE,'YYYY') = '2009' ))
AND (TO_CHAR(AV2.AWDATE,'Q') = '4')
AND (to_CHAR(AV2.AWDATE,'YYYY') = '2009')
GROUP BY TO_CHAR(NVL(AV2.TAX_ID,999999999),'000000000'),
  AV2.FIRM_NAME,
  AV2.BIDCLASS,
  AV2.AWAMT,
  AV2.SOL_MODE,
  AV2.CERT,
  AV2.ETHNICITY,
  AV2.PO_NUMBER_FORMAT Can someone provide a solution?
Thank you,
Robert

Hi,
You can take the parameters to the select so that you will be able to create conditions over them.
Try to use this SQL instead of your and in the discoverer workbook create the conditions and parameters:
SELECT TO_CHAR(NVL(AV.TAX_ID,999999999),'000000000') FEID,
AV.FIRM_NAME VENDOR_NAME,
AV.BIDCLASS CONTRACT_CODES,
AV.AWAMT AWARD_AMOUNT,
AV.SOL_MODE FORMAL_INFORMAL,
AV.CERT BUSINESS_ENTITY,
AV.ETHNICITY ETHNICTY,
AV.PO_NUMBER_FORMAT CONTRACT,
TO_CHAR(VP.PAYMENT_DATE,'YYYY') P_YEAR,
TO_CHAR(VP.PAYMENT_DATE,'Q') P_QTR
SUM(VP.INVOICE_AMOUNT) AMOUNT_PAID_$
FROM CONFIRM.VSTATE_PAID_AWARD_VENDORS AV,
CONFIRM.VSTATE_VENDOR_PAYMENTS VP
WHERE ( ( AV.PO_NUMBER = VP.PO_NUMBER
AND AV.VENDOR_ID = VP.VENDOR_ID ) )
--AND (TO_CHAR(VP.PAYMENT_DATE,'Q') = '4')*
--AND ( TO_CHAR(VP.PAYMENT_DATE,'YYYY') = '2009' )*
GROUP BY TO_CHAR(NVL(AV.TAX_ID,999999999),'000000000'),
AV.FIRM_NAME,
AV.BIDCLASS,
AV.AWAMT,
AV.SOL_MODE,
AV.CERT,
AV.ETHNICITY,
AV.PO_NUMBER_FORMAT ,
TO_CHAR(VP.PAYMENT_DATE,'YYYY') P_YEAR,
TO_CHAR(VP.PAYMENT_DATE,'Q') P_QTR
union
SELECT TO_CHAR(NVL(AV2.TAX_ID,999999999),'000000000') FEID,
AV2.FIRM_NAME VENDOR_NAME,
AV2.BIDCLASS CONTRACT_CODES,
AV2.AWAMT AWARD_AMOUNT,
AV2.SOL_MODE FORMAL_INFORMAL,
AV2.CERT BUSINESS_ENTITY,
AV2.ETHNICITY ETHNICTY,
AV2.PO_NUMBER_FORMAT CONTRACT,
TO_CHAR(VP.PAYMENT_DATE,'YYYY') P_YEAR,
TO_CHAR(VP.PAYMENT_DATE,'Q') P_QTR
0 AMOUNT_PAID_$
FROM CONFIRM.VSTATE_PAID_AWARD_VENDORS AV2
WHERE
not exists (SELECT 'X'
FROM CONFIRM.VSTATE_VENDOR_PAYMENTS VP2
WHERE av2.po_number = vp2.po_number
AND (TO_CHAR(VP2.PAYMENT_DATE,'Q') = TO_CHAR(VP.PAYMENT_DATE,'Q') )
AND ( TO_CHAR(VP2.PAYMENT_DATE,'YYYY') = TO_CHAR(VP.PAYMENT_DATE,'YYYY') ))
--AND (TO_CHAR(AV2.AWDATE,'Q') = '4')*
--AND (to_CHAR(AV2.AWDATE,'YYYY') = '2009')*
GROUP BY TO_CHAR(NVL(AV2.TAX_ID,999999999),'000000000'),
AV2.FIRM_NAME,
AV2.BIDCLASS,
AV2.AWAMT,
AV2.SOL_MODE,
AV2.CERT,
AV2.ETHNICITY,
AV2.PO_NUMBER_FORMAT,
TO_CHAR(VP.PAYMENT_DATE,'YYYY') P_YEAR,
TO_CHAR(VP.PAYMENT_DATE,'Q') P_QTR
Tamir

Similar Messages

  • HT2494 How do I output video to a projector from my MacPro17 with only firewire and USB ports?

    How do I output video to a projector from my MacPro17 with only firewire and USB ports?

    No Mac Pro only has Firewire and USB.    Perhaps you've misidentified the computer:
    http://www.everymac.com/ should help.

  • OBIEE: REPORT FROM 2 FACTS WITH ONE SHARED AND ONE UNSHARED DIM; POSSIBLE??

    Hi All,
    We have a typical scenario to build a report from 2 subject areas(ideally from 2 facts)
    Here is the Scenario: Creating a report which based on two facts(2 Subject Area's) and one common dimension and one unshared dimension.
    Example
    ======
    Dimension Date is common between Fact Transaction and Fact Credits.
    Dimension Credit Type is applicable only for Fact Credit.
    We have to build a report with the below mentioned attributes/metrics
    Dim Date. Attribute (*Common Dimension*)
    Fact.Transaction.Metric
    Fact. Credit .Metric
    Dim.Credit Type. Attribute (*Unshared Dimension*)
    Is this is possible in OBIEE..?
    Thanks,
    Govardhana

    Yes, you must use measure levels. Set the column level of each measure from the Transaction Fact to Total for the Credit Type dim.

  • Generate Report from SQL Query with Parameter

    I have a web application that needs to generate static PDF reports. What I want to do is:
    1. Use Acrobat to create a form
    2. Open the form programmatically on the webserver
    3. Pass it a parameter such as a "clientID"
    4. Automatically populate the rest of the form using a SQL stored procedure with the clientID as the parameter
    5. Save the form as a static, non-editable PDF and display it for the client to either view/save/print
    Example:
    Database would contain a table called Clients
    ID LastName Location Phone
    1 Doe New York 111-111-1111
    2 Smith California 222-222-2222
    Stored Procedure
    CREATE PROCEDURE GetClient
    @id int
    AS
    SELECT LastName, Location FROM Clients WHERE ID = @id
    GO
    Acrobat Form
    Last Name: [txtLastName]
    Location: [txtLocation]
    Website user requests report for clientID=1. Result is a PDF that looks like this:
    Last Name: Doe
    Location: New York
    I am very new to Acrobat, so please explain in detail how I can go about doing this. Thanks very much in advance.

    Good morning. Did you find a solution to your problem? I'm looking for something to do the same for a from created in Live Cycle 7.0. If you can share some information or examples, I would greatly appreciate it.
    Thanks
    Ernest

  • Width of field in Report From SQL Query

    I have created a report from SQL query with 15 columns being selected. However, no matter what column width and column type (pixel, char, percent) I enter in the column formatting tab of the report, I cannot get the report to format the column to the width I desire. It is always a fixed width. Does anyone have any suggestions?
    Thanks,
    Martin

    Hi,
    Char (used for ASCII format)
    Displays the output in the specified number of
    characters per line. For example, if you enter 20
    in Width, the report displays 20 characters of the
    column data in each line. If the number of
    characters per line exceeds the specified
    number, the remaining characters are wrapped
    to the next line.
    Pixel
    Displays the output in the specified number of
    pixels per row. For example, if you enter 10 in
    Width, the column data displays 10 pixels of
    data per line of the displayed table.
    Percent
    Displays the output in the specified percentage
    of the table. For example, if you enter 25 in
    Width, the column data displays in 25% of the
    displayed table.
    Thanks,
    Sharmila

  • Can Portal Report from SQL Query use where column IN (:bind_variable)

    I would like to create a portal report from sql query with IN (:bind_variable) in the where clause. The idea is that the user would enter comma-separated or comma-quote-separated values for the bind_variable. I have tried this several ways but nothing seems to work. Can this be done?
    Trenton

    Hi,
    Which version of portal are you using. This is a bug. It has been fixed in 30984.
    Thanks,
    Sharmila

  • HT4191 iPhone Local Storage "My iPhone" - How do you create this folder for use by the Notes app on a iPhone or iPad?  If I want to keep some notes only on my device and not in a cloud environment associated with an e-mail account.

    iPhone Local Storage "My iPhone" - How do you create this folder for use by the Notes app on a iPhone or iPad?  If I want to keep some notes only on my device and not in a cloud environment associated with an e-mail account.  I've seen reference to the  "My iPhone" local storage put no mention on how you create this folder or access this folder within the Notes app.  I realize storing information in a local storage like this provides no syncing between other iDevices but that is exactly what I'm looking for.  I'm running iOS7.0.4 on a iPhone 5S, and a iPad Air.  Any help would be greatly appreciated.

    If you go to Settings > Notes > Default Account you will see "On My iPhone" as the default account and the only choice if you have not enabled syncing Notes in Settings >iCloud or Settings > Mail, Contacts, Calendars. If you have enabled syncing you can still select "On My iPhone" as the default account. When you are in the Notes app you won't see any accounts listed if you have not enabled syncing because they are all in the On My iPhone account and that is the only place possible. It is not a folder that you create.

  • HT2798 I have a Mac OS 10.6.8 server in my classroom that I have networked to each student's account.  How do I create a folder that allows them to place their finished assignments in it, but does not allow them to go in and remove anything from that fold

    I have a Mac OS 10.6.8 server in my classroom that I have networked to student accounts on the iMacs in the room.  How do I create a folder that allows studnts to place their finished assignments in it, but does not allow them to go in and remove anything from that folder?

    You want a "Drop Box" style folder. You should be able to achieve this by creating a folder and giving it permissions similar to the "Drop Box" folder in your users Public Folder (i.e. write only permissions.)

  • How do I create a folder in the root directory

    Hi
    How do I create a folder in the root directory?
    Once I do that I need to create a note book file in that folder
    Any help would be much appreciated
    Thanks
    Brian

    Hi Brian,
    Open Macintosh HD in the Finder, then SHIFT+CMD+n
    Root Directory is the top level of the drive.

  • How do I create a folder in mail?

    How do I create a folder within a mail account?

    If you are on iOS 5 and it's an IMAP type account then you should get an Edit button at the top of the list of folders that you currently have on your email account. If it's a POP type account or if you are still on iOS 4 then you won't get the Edit button.

  • How do I create a folder in notes

    How do I create a folder within notes on my ipad2?

    You cannot create folders in the Notes App on the iPad. Notes are tied to your mail accounts. You can tap on the Accounts button in the upper left corner of the app to switch from notes in one mail account to the another mail account.

  • How do i create a folder toorganize my documents in Word for Mac?

    How do I create a folder to organize my documents in Word for MAC. I have the 2011 version.

    Just a tip...
    I create folders in my Documents folder: "Word Docs", "Excel Docs" and "PowerPoint Docs".
    No need for an "Outlook Docs" because that's all stored in the "Microsoft User Data" folder in your Documents folder.
    Along with the video that Andy provided, you should be able to manage your Office documents well.
    Good luck,
    Clinton

  • How do I create a folder from my email to my home screen

    How do I create a folder for some emails I receive to be placed on my home screen

    You can't have an email folder on your iPad's homescreen, you can only create a folder and access your emails folders within the Mail app (or via Safari or an email app from the store).
    To create an email folder within the Mail app, then if your iPad is on iOS 5+ and it's an IMAP type account then you should get an Edit button at the top of the list of folders that you currently have on your email account. If it's a POP type account then you won't get the Edit button.

  • How do I Create multipage Web-ready reports in the evaluvatio​n version of DIADEM?

    I need to create a multi page web report. How do I do this using the evaluvation version of DIADEM? Does Diadem support web-based reports?

    Hi SriramSharma
    In DIAdem REPORT, the 4th panel of the left hand side, you create multi-page reports from 2D&3D graphs, tables, pictures and texts.
    When you save this templete is stores into an XML based file formate that DIAdem reads called TDR. This is so you can resue these templates with what ever dataset you want.
    However you also have the choice from the file menu in DIAdem REPORT (4th panel) to export to an HTML report.
    After you have desinged you template, and are displaying data, select "HTML Export" from the file menu in DIAdem REPORT. This will save your file in a format that is compatible with web browsers.
    Let me know if you have any additional questions
    Thanks
    Tom Ferraro
    DIAdem Product Manager
    512-683-6841

  • How do I create a folder for private documents which can be password protected?

    how do I create a folder which can be password protected please?

    You can do this by creating a protected disk image.
    Instructions here http://www.macworld.com/article/154559/2010/10/password_protect_folders.html
    Or you can buy and use software like this one: http://www.apimac.com/mac/secretfolder/
    The disk image option is free and easy to do.

Maybe you are looking for

  • SNP Planned Order without PPM

    Hi Gurus, I have a small confusion, Some of my products in a Production Plant donot have a  SNP PPM. and when i run network heuristic on that location product. It creates SNP Planned orders. Just for information the product location master has procur

  • No longer able to download pdf files from websites.

    I am running Firefox 11.0 & Aurora on a Mac with OS X 10.6.8. I used to be able to download pdf files, such as my bank staements, direct from websites with no problem on either browser. Recently, when clicking on the link, the dialog box asking wheth

  • Problem with the wrong host name, when accessing IR or ID

    Hey all, I am trying to accessing the IR and ID at my client however the wrong host name is being called. For instance the URL should start nero.bcm.tmc.edu, but it is calling just nero. The basis guy here fixed a similar problem in the exchange prof

  • Using my MacBook in Japan

    Hi, I live in the UK and bought my MacBook here. I need to take it for work purposes to Japan and was wondering if it will be okay to use the power adapter on their mains (obviously I will have to buy and adapter for the plug but it is the Voltage an

  • Friends email is being rejected

    I purchased a new computer 2/17 w/Windows 8.1.  Since that time one of my email pals has all of his emails sent to me rejected with "Error 554 5.7.1 [P4] Message blocked due to spam content in the message"  He receives this rejection even when he is