Program Adding variable in query

Hi,
We have a new object which must be as variable in our queries (~100 queries).
I need to know if someone has already developp a programm to add automatically an infoobject as variable in queries.
I think that we should use Function module 'RSZ_X_COMPONENT_SET' but how do we fill correctly parameters?
Thanks & regards

Dear Darius,
Instead of Variable why dont you restrict that Characteristic with ONE value ?
If it is variable > create that with processing tyep Customer exit and write the code.
Regards,
Ramkumar.

Similar Messages

  • Variable for Query without changing Datamodel

    Hello Experts,
    I need in the Query a variable, which should have inpact on the processing in the user-exit. This variable should no be used directly for constraining data.
    It is an Yes/No variable. And I don't have in my multicube any characteristic which have Yes/No in their domain.
    In such situation I have always added to Multiprovider and Cube an new characteristic and created an variable for this characteristic.
    But I don't like this solution, because this changes in the datamodel are in really not important for the datamodel. It only an work around for getting the possibility of adding a variable.
    Does someone know an better idea for adding variables to query, without changing datamodel like this.
    Thanks
    Wojciech

    Hi Bhanu,
    Not really - I don't want to change Cubes.
    Thanks
    Wojciech

  • How to reference Report level program unit in report query?

    I have created a report level function FREF13 which returns a VARCHAR2 variable. I am trying to reference this function in report SQL statement like:
    select * from wtr where file_ref = FREF13(:fref)
    I am getting error 'ORA-00904: Invalid column name' error. This is because it is unable to recognize FREF13 as local function.
    Is it possible to reference local program units in report query?
    Rgds,
    Manish

    No, it's not possible. The only things you can reference in a SQL query are columns and functions accessable in the database (since this is where the query is executed). You should create the function in the database.
    Regards,
    Danny

  • How to assign current date/time to a formula variable in Query Designer

    How do I assign the current date to a formula variable in Query Designer? I need to use current data in a calculation and just need the date the report was run.
    Thanks

    Hi Philip,
    There is an SAP formula variable to supply the current date in a formula. I think it is 0F_ADAY...install it from business content if you cannot see it in the query designer (formula box, under formula variables) and try using it.
    Hope this helps...

  • Can we create range variable for Query Key Date

    Hello Gurus,
    Can we create a range variable for Query Key Date ? when I tried to give a range of values for Query Key Date, I am unable to find Range Values option. I found only Single Values.
    so, Please let me know if we can use Range variables for Query Key Date ??
    Thanks in advance,
    Regards,
    Aarthi

    Hi Aarthi,
    This is relevant for the time dependant master data that is being pulled in thw query. Like if you are using a nav attr in the query and this nav attr is time dependant, then which record (from the char master data) is to be pulled into the report, depends upon the key date that you specify.
    The default key date value is the date on which the query is executed, that is <Today>.
    Hope this helps...

  • Fox Formula Variable In Query Designer

    Hi Experts,
    I have created 1 variable in fox formula of type VARV and i want this Variable to show in query designer while creating new Variable so that i can replace the Query Variable With Fox Formula by Using Replacement Path.
    While Creating new variable in Query Designer it is not Showing that Fox Formula variable.
    Because i want to use this in WAD While Executing the Planning Sequence.
    Is there any way we could get That Fox Formula variable in Query Designer.
    Regards
    Girish

    Hi Marc,
    While Creating Variable from Query Using Query Properties it is still not Showing That Variable in Fox Formula.
    And My Requirement was to Replace that Fox Formula Variable With Query Designer Variable.
    Please Suggest any Solution.
    Thanks
    Girish

  • Programs generated using ABAP query vanishes after upgrade

    Hi all,
    The programs generated using abap query in sq01 vanishes after upgrading from 4.6C to ECC 6.0 system.
    Is this a know issue, do we have a solution for this?
    Can anyone help
    Thanks
    Senthil

    Hi,
    Try to generate the Queries again in the new system...using the FM : RSAQ_GENERATE_PROGRAM
    The input needed is the Query name and the usergroup...The details can be obtained from the table AQLQCAT(local queries areas) and AQGQCAT(global areas queries).
    Once you generate the query , a program gets created...
    if you have lots of queries to be genretated, write a custom report by fetching the data from the above tables and use the FM to generate the same...
    Hope this helps you..
    Reward if useful
    Regards
    Shiva

  • Can't subtotal on measure variables from Query 2 in merge dimension report

    I use a query identifying customers (Query1.HH_ID) sold by each salesperson. A second query identifies a subset of those customers who are longtime customers. I merge these queries using the dimension, HH_ID. I project Query1.HH_ID onto the report and create a variable via =If([Query2].[HH_count]=1;1;0) to get a measure which is either 1 or 0 depending on whether a record is retrieved from Query2 with a value for Query2.HH_ID that matches Query1.HH_ID. The report is fine at the detail level, but when I insert a break and try to subtotal the measures, the variable from Query 2 produces a subtotal of 0 even though I can see a mixture of detail records with 1s and 0s. It appears that one cannot subtotal on measures from Query2 in a merged dimension report, or at least not if the merged dimension is not projected onto the report but rather only the dimension from Query1. Is this a known principle?

    Hi Michael,
    I think the issue is that they Query2.HH_Count is being summed first. So if you have a mixture of values, say
    rownumber, value
    1,1
    2,0
    3,1,
    4,0
    you will get 0 as your HH_count will equal 2.
    Try
    =If(Query2.HH_count>=1;1;0)
    Alternatively try
    =If(Average(Query2.HH_count)=1;1;0)
    Hope this helps
    Alan

  • Adding tcode to query

    Hello Gurus,
    I want to add my Query to a tcode. My Query is a Global one i.e cross client. I have used the tcode START_REPORT in SE93 AND assigned D_SREPOVARI-REPORTTYPE = AQ, D_SREPOVARI-REPORT =  "User Group ", D_SREPOVARI-EXTDREPORT = "Query Name". But when i run the tcode i get a message that the user group is not created. I also tried this method : D_SREPOVARI-REPORT =  "User Group" space G.
    But i still get the same error.
    Any idea ?
    Regards,
    Abhishek.

    Hi,
    First try to assign the User group for the query in SQ01..
    and below code will help in checking the background program  name generated for Query
          IF p_rb4 = 'X'.
    *       Fetching Query names avaialable for Standard Area
    *       Validating Query Group
            SELECT SINGLE * FROM aqltq  WHERE num = p_qname.
            IF sy-subrc NE 0.
            ENDIF.
    *       Validating Query Group & Query Name
            SELECT SINGLE * FROM aqltq  WHERE num  = p_qname
                                        AND   qnum = p_pname.
            IF sy-subrc NE 0.
            ENDIF.
          ELSE.
    *       Validating Query Group for Global Area
            SELECT SINGLE * FROM aqgtq  WHERE num = p_qname.
            IF sy-subrc NE 0.
            ENDIF.
    *       Validating Query Group & Query Name
            SELECT SINGLE * FROM aqgtq  WHERE num  = p_qname
                                        AND   qnum = p_pname.
            IF sy-subrc NE 0.
            ENDIF.
          ENDIF.
    *     Validating Variant name for Query Name
          CONCATENATE '%' p_qname '%' p_pname '%' INTO w_rname.
          SELECT SINGLE * FROM varid WHERE report LIKE w_rname
                                     AND   variant EQ p_variant.
          IF sy-subrc NE 0.
         ENDIF.
    or
    "try to fetch the background report generated for the query name by using above query..
    "then create a transaction for above query same as report
    Prabhudas

  • Syntax error when adding variables in recordset (query)

    MySql,PHP,Dreamweaver,WindowsVista
    Hi I am receiving a syntax error: invalid quantifier ++ $orderNum;s*?> when adding two variables in the recordset (query) dialog box. I get the error when clicking OK.
    Here is what is entered:
    name: fieldname
    type: text
    default: -1
    runtime value: $_GET['Field']
    name: searchvalue
    type:text
    default: -1
    runtime value: $_GET['Search']
    Can anyone help with this?

    That's a completely separate issue. The error message is telling you that you have not defined the testing server correctly in the Site Definition dialog box.
    The Host directory field and URL prefix should both point to the same place, in other words, the root of your website. Host directory is the physical path, while URL prefix is the address you would put in a browser address bar.
    Select Site > Manage Sites. Select the name of the site, and click the Edit button. In the Site Definition dialog box, select the Advanced tab, and then choose Testing server from the Category list on the left.
    Depending on how your remote login works, Host directory should probably be public_html or just /. Use the same value as in the Remote server part of the Site Definition dialog box. The URL prefix should be http://gaylehansen.aisites.com/.

  • Adding variable to the query

    All,
    Creating a variable for the restricted info object in the query is taken care  by the security folks or developers?

    Hey,
    For the created variable for characteristics in the query ,I have to secure the coressponding charatcteristics
    value by creating analysis authorization object.I assigned 0tcavalid,0tcaiprov,0tcaactvt,0wbs_elemt (which
    is my restricted info object )to the custom authorization(everything made active and auth.relevant).I am not
    sure what type of values to enter in the each intervals for the characteristics and under 0tcaiprov what value
    should I give??

  • Variable For Query Key Date

    Hi All,
    I am using time dependent master data, i want to count number of employees on particular key date for diffferent Orgunits. So i created variable in the query properties for dynamic date selection .I also have other variable - Calendar month.
    If the user enters particular  Calendar Day (21.03.2008), then the report should show the total number of employees for that particular day.
    If the user chooses Cal Year/month  then the report should show the total number of employees for that time frame (12.2007-12.2008).
    When i enter Cal Year/month and execute the system not allowing to execute the report. It says Calender Day is mandatory.
    How can i bypass the calenderday when i choose calyear/month.
    Variable for Key date :
    Char - Calender Day
    Mandatory
    Ready for Input
    Regards
    A.Vasister

    Hi,
    For this work you have to create another 2 variable.
    1. Make your both user entry variables as optional.
    2. Create another 2 variables processing type as user exit.
    3. In the CMOD program, identify which variable contains data.
       - If the user entered month, then in the user exit of Calender day's from date should be
         first day of the month parameter and to    date should be the last date of the month parameter.
       - If the user entered date, then pass corresponding month&year value of the date to calmonth variable.
    Let me know the position.
    Vivek

  • System variable in query

    Hi, all-
    I'm trying to set up a query for my users that don't have access to customer aging reports.  I need them to run this query to see how many days past due the customer is before we ship an order.
    I think I need to add the system variable 65 (Days Overdue), but not sure how to add it to an SAP query.
    Using 2007A patch 42.
    thanks in advance,
    Shelby

    The system variables are accessible only in system defined forms. They are received from the program running in the background.
    In the queries you write you can only access data base fields. And sometimes from these you can derive the same value that the system variable contains.

  • Adding columns in query causes renames of fields

    Hi All, I'm using Oracle Reports Builder 10g. I have a query which has connections to other queries. When I try to add two columns into that query and recompile the RDF it automatically renames other fields adding "1" at the right side. Any ideas why this is happening? I'm not adding columns with names already existed. Thanks in advance, A. Stoyanov

    Hi, The query is :
    SELECT 0 CUSTOMER_TRX_ID,
           rpad('a', 20, '-') TRX_NUMBER,
           0 TERM_SEQUENCE_NUMBER,
           rpad('a', 40, '-') TRX_TYPE,
           rpad('a', 80, '-') TRX_TYPE_NAME,
           'a' OPEN_RECEIVABLE_FLAG,
           SYSDATE TRX_DATE,
           0 SHIP_TO_CUSTOMER_ID,
           0 SHIP_TO_CONTACT_ID,
           0 REMIT_TO_ADDRESS_ID,
           0 PRIMARY_SALESREP_ID,
           rpad('a', 30, '-') CUSTOMER_NUMBER,
           rpad('a', 240, '-') INTERNAL_NOTES,
           0 BATCH_SOURCE_ID,
           rpad('a', 240, '-') TRX_COMMENTS,
           0 PREVIOUS_CUSTOMER_TRX_ID,
           0 SHIP_TO_SITE_USE_ID,
           0 PRINTING_COUNT,
           SYSDATE PRINTING_ORIGINAL_DATE,
           SYSDATE PRINTING_LAST_PRINTED,
           'a' PRINTING_PENDING,
           0 LAST_PRINTED_SEQUENCE_NUMBER,
           SYSDATE START_DATE_COMMITMENT,
           SYSDATE END_DATE_COMMITMENT,
           0 INITIAL_CUSTOMER_TRX_ID,
           rpad('a', 15, '-') INVOICE_CURRENCY_CODE,
           0 TERM_ID,
           SYSDATE SHIP_DATE_ACTUAL,
           rpad('a', 30, '-') SHIP_VIA,
           rpad('a', 50, '-') WAYBILL_NUMBER,
           rpad('a', 50, '-') PURCHASE_ORDER_NUMBER,
           rpad('a', 50, '-') PURCHASE_ORDER_REVISION,
           SYSDATE PURCHASE_ORDER_DATE,
           SYSDATE TERM_DUE_DATE_FROM_PS,
           0 TERM_RELATIVE_AMOUNT,
           rpad('a', 15, '-') TERM_NAME,
           0 BILL_TO_CUSTOMER_ID,
           0 BILL_TO_CONTACT_ID,
           0 BILL_TO_SITE_USE_ID,
           rpad('a', 40, '-') BILL_TO_LOCATION,
           rpad('a', 360, '-') BILL_CUST_NAME,
           rpad('a', 40, '-') BILL_ADDRESS1,
           rpad('a', 40, '-') BILL_ADDRESS2,
           rpad('a', 40, '-') BILL_ADDRESS3,
           rpad('a', 40, '-') BILL_ADDRESS4,
           rpad('a', 60, '-') BILL_CITY,
           rpad('a', 60, '-') BILL_STATE,
           rpad('a', 60, '-') BILL_POSTAL_CODE,
           rpad('a', 60, '-') BILL_COUNTRY,
           rpad('a', 50, '-') BILL_SITE_TAX_REFERENCE,
           rpad('a', 50, '-') BILL_CUST_TAX_REFERENCE,
           0 TRX_LINE_AMOUNT,
           0 TRX_TAX_AMOUNT,
           0 TRX_FREIGHT_AMOUNT,
           0 TRX_ALL_AMOUNT,
           rpad('a', 360, '-') ORDER_BY,
           rpad('a', 240, '-') BILL_TO_ADDRESS1,
           rpad('a', 240, '-') BILL_TO_ADDRESS2,
           rpad('a', 240, '-') BILL_TO_ADDRESS3,
           rpad('a', 240, '-') BILL_TO_ADDRESS4,
           rpad('a', 60, '-') BILL_TO_STATE,
           rpad('a', 60, '-') BILL_TO_PROVINCE,
           rpad(‘a’, 150, ‘ - ’) our_ref,,
           rpad(‘a’, 150, ‘ - ’) your_ref
      FROM dual
    WHERE 1 = 2
    UNION ALL &common_query
    The bind variable &common_query is accepting the following sql:
    'SELECT
    ' ||:P_SEL_TRX_ID ||'           
    CUSTOMER_TRX_ID
    ' || :P_SEL_TRX_NUMBER  ||'                 
    TRX_NUMBER
    NVL(TL.SEQUENCE_NUM,1)               
    TERM_SEQUENCE_NUMBER 
    ' || :P_SEL_TRX_TYPE ||' 
    TRX_TYPE
    ,       ' || :P_SEL_TRX_TYPE_NAME||' 
    TRX_TYPE_NAME
    ,       TYPES.ACCOUNTING_AFFECT_FLAG     
    OPEN_RECEIVABLE_FLAG
    ,       ' || :P_SEL_TRX_DATE  ||'       
    TRX_DATE
    ,       SHIP_TO_CUSTOMER_ID                   
    SHIP_TO_CUSTOMER_ID
    ,       SHIP_TO_CONTACT_ID                   
    SHIP_TO_CONTACT_ID
    ,       REMIT_TO_ADDRESS_ID                   
    REMIT_TO_ADDRESS_ID
    ,       A.PRIMARY_SALESREP_ID                 
    PRIMARY_SALESREP_ID
    ,       B.ACCOUNT_NUMBER                     
    CUSTOMER_NUMBER
    ,       A.INTERNAL_NOTES                     
    INTERNAL_NOTES
    A.BATCH_SOURCE_ID
    BATCH_SOURCE_ID
    A.COMMENTS
    TRX_COMMENTS
    ,       PREVIOUS_CUSTOMER_TRX_ID             
    PREVIOUS_CUSTOMER_TRX_ID
    ,       SHIP_TO_SITE_USE_ID                   
    SHIP_TO_SITE_USE_ID
    ,       NVL(PRINTING_COUNT,0)                 
    PRINTING_COUNT
    ,       PRINTING_ORIGINAL_DATE               
    PRINTING_ORIGINAL_DATE
    ,       PRINTING_LAST_PRINTED                 
    PRINTING_LAST_PRINTED
    ,       PRINTING_PENDING                         PRINTING_PENDING
    ,       LAST_PRINTED_SEQUENCE_NUM             LAST_PRINTED_SEQUENCE_NUMBER
    ,       START_DATE_COMMITMENT                    START_DATE_COMMITMENT
    ,       END_DATE_COMMITMENT                      END_DATE_COMMITMENT
    ,       INITIAL_CUSTOMER_TRX_ID                  INITIAL_CUSTOMER_TRX_ID
    ,       A.INVOICE_CURRENCY_CODE                  INVOICE_CURRENCY_CODE
    ,       A.TERM_ID      TERM_ID
    ,       A.SHIP_DATE_ACTUAL                       SHIP_DATE_ACTUAL
    ,       A.SHIP_VIA                                 SHIP_VIA
    ,       A.WAYBILL_NUMBER                        WAYBILL_NUMBER
    ,       A.PURCHASE_ORDER                         PURCHASE_ORDER_NUMBER
    ,       A.PURCHASE_ORDER_REVISION              PURCHASE_ORDER_REVISION
    ,       A.PURCHASE_ORDER_DATE                    PURCHASE_ORDER_DATE
    ,       P.DUE_DATE                                 TERM_DUE_DATE_FROM_PS
    ,       NVL(TL.RELATIVE_AMOUNT,100)* (100/NVL(T.BASE_AMOUNT,100))         TERM_RELATIVE_AMOUNT
    ,       T.NAME                    TERM_NAME
    ,       A.BILL_TO_CUSTOMER_ID                    BILL_TO_CUSTOMER_ID
    ,       A.BILL_TO_CONTACT_ID                     BILL_TO_CONTACT_ID
    ,       A.BILL_TO_SITE_USE_ID                    BILL_TO_SITE_USE_ID
    ,       U_BILL.LOCATION                              BILL_TO_LOCATION
    ,       NVL(A_BILL.TRANSLATED_CUSTOMER_NAME,PARTY.PARTY_NAME)     BILL_CUST_NAME
    ,       RTRIM(RPAD(LOC.ADDRESS1,40))      BILL_ADDRESS1
    ,       RTRIM(RPAD(LOC.ADDRESS2,40) )      BILL_ADDRESS2
    ,       RTRIM(RPAD(LOC.ADDRESS3,40) )     BILL_ADDRESS3
    ,       RTRIM(RPAD(LOC.ADDRESS4,40) )      BILL_ADDRESS4
    ,       LOC.CITY                                BILL_CITY
    ,       NVL(LOC.STATE , LOC.PROVINCE)   BILL_STATE
    ,       LOC.POSTAL_CODE                       BILL_POSTAL_CODE
    ,       LOC.COUNTRY                           BILL_COUNTRY
    ,       U_BILL.TAX_REFERENCE                     BILL_SITE_TAX_REFERENCE
    ,       PARTY.TAX_REFERENCE                          BILL_CUST_TAX_REFERENCE
    ,       ' ||:P_SEL_TRX_LINE_AMOUNT||'        TRX_LINE_AMOUNT
    ,       ' ||:P_SEL_TRX_TAX_AMOUNT ||'              TRX_TAX_AMOUNT
    ,       ' ||:P_SEL_TRX_FREIGHT_AMOUNT||'               TRX_FREIGHT_AMOUNT
    ,       ' ||:P_SEL_TRX_ALL_AMOUNT  ||'               TRX_ALL_AMOUNT
    ,       ' || L_ORDER_BY || '     ORDER_BY
    ,      LOC.ADDRESS1      BILL_TO_ADDRESS1
    ,     LOC.ADDRESS2      BILL_TO_ADDRESS2
    ,      LOC.ADDRESS3      BILL_TO_ADDRESS3
    ,      LOC.ADDRESS4      BILL_TO_ADDRESS4
    ,      LOC.STATE      BILL_TO_STATE
    ,      LOC.PROVINCE      BILL_TO_PROVINCE
    , a.attribute1 as our_ref
    , a.attribute2 as your_ref
    FROM    ' || :P_TABLE1 || '
    WHERE  ' || :P_WHERE1 || '
      ' || :P_USER_WHERE_CLAUSE1 || '
      ' || :P_USER_WHERE_CLAUSE2 || '
      ' || :P_USER_WHERE_CLAUSE3 || '
      ' || :P_MLS_CONDITION || '
      ' || :P_EC_WHERE_CLAUSE || '
            ' || :P_BR_WHERE_CLAUSE || '
            ' || :lp_trx_num_high || '
            ' || :lp_trx_num_low || '
            ' || :lp_trx_date_clause ||'
            ' || :lp_doc_seq_clause|| '
    UNION
    SELECT   ' || :P_SEL_TRX_ID || '
    ,  ' || :P_SEL_TRX_NUMBER || '
    ,  NVL(P.TERMS_SEQUENCE_NUMBER,1)
    ,   ' || :P_SEL_TRX_TYPE || '
    ,  ' || :P_SEL_TRX_TYPE_NAME || '
    ,  TYPES.ACCOUNTING_AFFECT_FLAG
    ,  ' || :P_SEL_TRX_DATE || '
    ,  A.SHIP_TO_CUSTOMER_ID
    ,  A.SHIP_TO_CONTACT_ID
    ,  A.REMIT_TO_ADDRESS_ID
    ,  A.PRIMARY_SALESREP_ID
    ,  B.ACCOUNT_NUMBER
    ,  A.INTERNAL_NOTES
    ,  A.BATCH_SOURCE_ID
    ,  A.COMMENTS
    ,  PREVIOUS_CUSTOMER_TRX_ID
    ,  SHIP_TO_SITE_USE_ID
    ,   NVL(PRINTING_COUNT,0)
    ,  PRINTING_ORIGINAL_DATE
    ,  PRINTING_LAST_PRINTED                
    ,  PRINTING_PENDING                      
    ,  LAST_PRINTED_SEQUENCE_NUM
    ,  START_DATE_COMMITMENT
    ,  END_DATE_COMMITMENT
    ,  INITIAL_CUSTOMER_TRX_ID
    ,  A.INVOICE_CURRENCY_CODE
    ,   A.TERM_ID
    ,   A.SHIP_DATE_ACTUAL
    ,  A.SHIP_VIA
    ,  A.WAYBILL_NUMBER
    ,  A.PURCHASE_ORDER
    ,  A.PURCHASE_ORDER_REVISION
    ,  A.PURCHASE_ORDER_DATE
    ,  P.DUE_DATE
    ,   NVL(TL.RELATIVE_AMOUNT,100)*
                     (100/NVL(T.BASE_AMOUNT,100))
    ,  T.NAME
    ,  A.BILL_TO_CUSTOMER_ID
    ,  A.BILL_TO_CONTACT_ID
    ,   A.BILL_TO_SITE_USE_ID
    ,  U_BILL.LOCATION                            BILL_TO_LOCATION
    ,  NVL(A_BILL.TRANSLATED_CUSTOMER_NAME,PARTY.PARTY_NAME)
                             BILL_CUST_NAME
    ,  RTRIM(RPAD(LOC.ADDRESS1, 40)) 
    ,  RTRIM(RPAD(LOC.ADDRESS2, 40) )                      
    ,   RTRIM(RPAD(LOC.ADDRESS3,  40) )                      
    ,  RTRIM(RPAD(LOC.ADDRESS4 ,  40) )                     
    ,   LOC.CITY                           
    ,  NVL(LOC.STATE , LOC.PROVINCE)                         
    ,   LOC.POSTAL_CODE                    
    ,  LOC.COUNTRY
    ,  U_BILL.TAX_REFERENCE
    ,  PARTY.TAX_REFERENCE
    ,   ' || :P_SEL_TRX_LINE_AMOUNT || '             
    ,  ' || :P_SEL_TRX_TAX_AMOUNT || '                
    ,  ' || :P_SEL_TRX_FREIGHT_AMOUNT  || '     
    ,  ' || :P_SEL_TRX_ALL_AMOUNT || '             
    ,   ' || L_ORDER_BY || '
    ,   LOC.ADDRESS1
    ,  LOC.ADDRESS2
    ,  LOC.ADDRESS3
    ,  LOC.ADDRESS4
    ,  LOC.STATE
    ,  LOC.PROVINCE
    , a.attribute1 as our_ref
    , a.attribute2 as your_ref
    FROM   ' || :P_TABLE2 || '
    WHERE  ' || :P_WHERE2 || '
      ' || :P_USER_WHERE_CLAUSE1 || '
      ' || :P_USER_WHERE_CLAUSE2 || '
      ' || :P_USER_WHERE_CLAUSE3 || '
      ' || :P_MLS_CONDITION || '
      ' || :P_EC_WHERE_CLAUSE || '
            ' || :P_BR_WHERE_CLAUSE || '
            ' || :lp_trx_num_low || '
            ' || :lp_trx_num_high ||'
            ' || :lp_trx_date_clause ||'
            ' || :lp_doc_seq_clause;
    The columns I added are OUR_REF and YOUR_REF which are at the end of the SELECT clause.
    Thanks,
    A.Stoyanov

  • Simple use of variables in query

    Hi,
    i've just started using PL/SQL and as a long time user of TSQL the syntax is a bit confusing for me. I'm trying to test a simple query - using a variable to select some rows from a table. Lest assume that we have a table with data from different days and we want to view data from specific day.
    I could use:
    SELECT * FROM TABLE
    where TRADE_DATE = '2010-10-23'
    but what i would like to do is to pass the date value as a variable, in TSQL i'd just write:
    declare @trade_date datetime
    set @trade_date = '2010-10-23'
    SELECT * FROM TABLE
    where TRADE_DATE = @trade_date
    Could someone help me and write the last query using PL/SQL syntax?
    Also - it there some kind of a tutorial for people like me? comparison of simple queries written in both languages? tried to google it but didn't have luck.

    There are a couple of differences besides variable syntax. The variable would look like this in PL/SQL:
    declare
        v_trade_date date := DATE '2010-10-23';
    begin
        select * into ?????  -- see below
        from   table
        where  trade_date = v_trade_date;
    end;However the next difference is that PL/SQL does not implicitly return result sets to the client application, so you either have to select <b>into</b> a PL/SQL variable, or process the values in a loop, or explicitly return a ref cursor (or just do the processing in SQL statements within the procedure, without returning anything). I don't know much about T-SQL but I have the impression that in Oracle there is a stronger distinction between SQL (the interpreted query language) and PL/SQL (the compiled programming language) than the equivalents in SQL Server. Saubhik's example above is not PL/SQL (which you asked about) but plain SQL.
    Using the example of SQL*Plus, you might use a ref cursor like this:
    var r refcursor;
    declare
        v_trade_date date := DATE '2010-10-23';
    begin
        open :r for
        select *
        from   test_table
        where  trade_date = v_trade_date;
    end;
    print :ror
    var r refcursor;
    create or replace procedure p (p_out_results out sys_refcursor)
    as
        v_trade_date date := DATE '2010-10-23';
    begin
        open p_out_results for
        select *
        from   test_table
        where  trade_date = v_trade_date;
    end p;
    set autoprint on
    exec p(:r)Edited by: William Robertson on Oct 24, 2010 5:31 PM

Maybe you are looking for

  • Error in crystal report Connection

    Hi I created a crystal report in SAP B1, its showing connectivity error when I  was viewing the report in SAP B1 .(I'm useing SAP 2007B) As u2018* failed to open the connection  u2019* Plz do need fully Regards Aravind M

  • Problem with data downloading to Application server - DIR_INTERFACE

    Hi, Im downloading data to application server and its working fine for directory DIR_SAPUSERS ( ./ ).  But the files are missing when trying to download the data to the path " /INTERFACES_D49/WORK/D49/ASG/FI/KRED/BKPF_AMS.TXT " in directory DIR_INTER

  • Create Navigational attribute from R/3

    Hi All, I have got requirement for one cube... "Create Navigation attribute from R/3 CCIHT_IA-DAT as Year, Month and YYMM with selection variable, range, optional" What does that mean ? how to create attribute from R/3 ? can anyone give me the steps

  • I just bought Creative Cloud Photography Plan and it doesn't work?

    So I just bought the CC photography plan and when I click the download now button it re-directs to a failed to open page....  Why?

  • Using Amplitube Metal with Garageband??

    Hey everyone, I'm very new to the mac world - fiance and I just bought one last month. We also purchased Amplitube Metal (which I suppose is some king of program that just gives you a lot of different effects) and the stealth pedal thing (sorry, I do