Replacement variable

I'm trying to use a replacement variable in the following script.
Someone can help me to find the error?
Thanks in advance
Paolo
SYS@orcl1 SQL> !uname -a
Linux localhost.localdomain 2.6.18-274.17.1.el5 #1 SMP Tue Jan 10 17:26:03 EST 2012 i686 i686 i386 GNU/Linux
SYS@orcl1 SQL> select * from v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
SYS@orcl1 SQL> !cat query1.sql
declare
TYPE QueryCurType is REF CURSOR;
query1 QueryCurType ;
cursor c1 is select owner,table_name from dba_tables where owner not in ('SYS','SYSTEM') and table_name not like '%$%';
cursor c2(t1 varchar2) is select column_name from dba_tab_columns where table_name=t1 and DATA_TYPE in ('NVARCHAR2','VARCHAR2','CHAR');
temp_var varchar2(3000);
query varchar2(3000);
begin
for tab1 in c1 loop
for col in c2(tab1.table_name) loop
query:='select '||col.column_name||' from '||tab1.owner||'.'||tab1.table_name||' where '||col.column_name||' like ' ||*'&&1'*;
dbms_output.put_line('executing..'||query);
open query1 for query;
loop
fetch query1 into temp_var;
if concat('a',temp_var) != 'a' then
dbms_output.put_line('Found String: "'||temp_var||'"# Column:'||col.column_name||'# Table:'||tab1.table_name);
end if;
exit when query1%NOTFOUND;
end loop;
end loop;
end loop;
end;
SYS@orcl1 SQL> @query1 '%TAB%';
old 11: query:='select '||col.column_name||' from '||tab1.owner||'.'||tab1.table_name||' where '||col.column_name||' like ' ||'&&1';
new 11: query:='select '||col.column_name||' from '||tab1.owner||'.'||tab1.table_name||' where '||col.column_name||' like ' ||'%TAB%';
declare
ERROR at line 1:
ORA-00911: invalid character
ORA-06512: at line 13
SYS@orcl1 SQL> @query1 %TAB%
old 11: query:='select '||col.column_name||' from '||tab1.owner||'.'||tab1.table_name||' where '||col.column_name||' like ' ||'&&1';
new 11: query:='select '||col.column_name||' from '||tab1.owner||'.'||tab1.table_name||' where '||col.column_name||' like ' ||'%TAB%';
declare
ERROR at line 1:
ORA-00911: invalid character
ORA-06512: at line 13

Hello,
DECLARE
    TYPE QueryCurType IS REF CURSOR;
    query1 QueryCurType ;
    CURSOR c1 IS
        SELECT  owner
               ,table_name
        FROM    dba_tables
        WHERE   owner NOT IN ('SYS','SYSTEM')
        AND     table_name NOT LIKE '%$%';
    CURSOR c2(t1 VARCHAR2) IS
        SELECT  column_name
        FROM    dba_tab_columns
        WHERE   table_name   =t1
        AND     data_type IN ('NVARCHAR2','VARCHAR2','CHAR');
    temp_var VARCHAR2(3000);
    query    VARCHAR2(3000);
BEGIN
    FOR tab1 IN c1 LOOP
        FOR col IN c2(tab1.table_name) LOOP
            query := 'select ' ||col.column_name||
                     ' from '||tab1.owner||'.'||tab1.table_name||
                     ' where '|| col.column_name ||
                     ' like ' ||'&&1';
            dbms_output.put_line('executing..'||query);
            OPEN query1 FOR query;
            LOOP
                FETCH   query1
                INTO    temp_var;
                IF CONCAT('a',temp_var) != 'a' THEN
                    dbms_output.put_line(
                        'Found String: "'||temp_var||'"# '||
                        'Column:'||col.column_name||'# '||
                        'Table:'||tab1.table_name);
                END IF;
                EXIT WHEN query1%NOTFOUND;
            END LOOP;
        END LOOP;
    END LOOP;
END;
/From your posting I cannot see where line 13 is. But my first attempt would be not to use Oracle keywords like QUERY as variable names.
Can you execute the block, when you manually replace the variable?
Regards
Marcus
P.S.: Please use tags around your code to preserve formatting.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Similar Messages

  • Using Replacement Variables Without Filtering in a Query

    I want to use a replacement variable for the posting period and for current fiscal week, but I do not want my query results to be filtered by these values.  Instead, I just want to show a column with the fiscal period as a number and the current week as a number.  Does anyone know how to do this? 
    My query shows JAN-DEC values for all key figures but when I use the replacement variable to display NOV as a number, JAN-OCT is blank b/c the query is filtering by NOV.  I just want to see a column of "11s". 
    Any ideas?

    Hi Tracey,
    I was not able to reply you yesterday. After you gave the details, I had this solution in mind but it was a Friday evening and I had to leave.
    My understanding :
    When user enters the month in selection screen eg: 11 (Nov)
    The key figure which is getting displayed in the report till month of Nov should be KF1 else it should be KF2.
    So report should be like this
    Jan  - KF1
    Feb  - KF1
    Mar  - KF1
    Apr  - KF1
    May  - KF1
    Jun  - KF1
    Jul  - KF1
    Aug  - KF1
    Sep  - KF1
    Oct  - KF1
    Nov  - KF1
    Dec  - KF2
    Solution:
    Make a Restricted KF - RKF1
    This will have KF1 with a restriction on the month column "<= " month enetered by user in selection screen (use the same variable)
    Make one more Restricted KF - RKF2
    This will have KF2 with a restriction on the month column "> " month enetered by user in selection screen (use the same variable)
    Now make a Calulated KF
    CKF = RKF1 + RKF2
    Use this in your report.
    I think this is what you are trying to get.
    Please do award points if you found this useful.
    Regards, Mey

  • How to create replacement variable

    Hi,
    Any one has idea how to create replacement variable in bps.
    I need to pass one variable value to another.\
    Because both the fields are fields to be change. But user does not want to do double entry.
    So need to pass one value from another. Is there any way. I can fix this issue.
    Thanks
    Naman Shah

    So far not found any answer so closing

  • Domain template with custom replacement variables

    Hi everyone,
    the following document explains how to use "replacement variables" to prepare runtime scripts (bash) when a domain is created from a template:
    http://docs.oracle.com/cd/E23943_01/web.1111/e14139/tempbuild.htm#i1100973
    Other than the listed variables, is it possible to create our own variables? If yes, how can we assign values to those custom variables when creating the domain from a WLST script?
    Thank you,
    Gabriel Lavoie

    Have you taken a look at this hotfix?
    http://support.microsoft.com/kb/2907591
    We had to apply it in order for our variables to be seen.
    joeblow

  • Replacement variable issue

    Hi Gurus,
    I need to create a replacement variable to use it in a formula in the structure. As I know to create a replacement variable I need to drag and drop characteristic in rows. Without draging the characteristic to rows/free characteristic how to create replacement variable. If drag it will change my aggregation level. I don't need that. Please advice is there any alternative way I could fix this problem.
    Thanks
    Liza

    You can try defining this new key figure production/no of days in cube itself. Since production is characteristic, calculate no of days and use update routines for Production/no of days.
    Assign points if helpful
    Regards!
    Manasa.

  • Replacement variables SQL Plus x PLSQL x APEX

    How Can I use replacement variables SQL Plus, integrating with APEX ,PLSQL?

    This isn't going very well is it?
    Perhaps it has something to do with a lack of knowledge of the english language, that you don't explain your case more, but I'll try to rephrase your question:
    You would like to call a query in SQL*PLUS from an Apex application?
    Then my answer would be simple: you can't.
    But my return question would be: why would you want that?
    You can also run your query in your Apex application and show the result on a page. Why is there a need to run it in SQL*PLUS?

  • How to dynamically replace variables in SMARTFORM texts based on item data?

    Hi experts,
    I'm currently designing a confirmation of order using Adobe PDF forms. The general layout with tables, pictures and texts was not big deal.
    But one tiny bit doesn't work and I'm becoming more and more desperate about it.
    We need various free texts for our pdf form. I created the texts using smartform texts. Some of these texts need to be slightly dynamic, so I added some dynamic fields in it.
    For example:
         "The material is currently out of stock.You can expect shipping around week &num_week&."
    To replace the dynamic field &num_week& in my interface, I read that I have to name the dynamic field exactly like the corresponding field in my interface. In my case this would be now:
         "The material is currently out of stock.You can expect shipping around week &SLS_PRT_COM-ITEM_DETAIL-ZZ_EXTRAFIELDS-ZZWEEKNUM&."
    To see the text on my form, I added a text object with type 'text module' and the proper textname. Of course I'm able to insert text on my form, save and activate it without problems. But if I want to print the form, nothing happens as the print program exits with an error code.
    After some hours I found out that this problem only occurs if I'm trying to replace the dynamic field with a field from the item table. Using a field from head details or globals like sy-mandt works like a charm.
    So my question is: Is it possible to use item data to replace dynamic fields of a smartform text?
    Greetings and thanks in advance!
    André

    Hi
    Have a look at the links below:
    LiveCycle ES2 * Adobe LiveCycle Designer ES2
    Using floating field in Adobe Forms to display text paragraph with dynamic variables in between
    After adding the floating field it will apeare in the hierarchy pallet above or bellow the text field.
    Good luck
    Shai.

  • How to replace variable value of a sql query dynamically

    Hi all,
    Trying to execute sql queries present in Oracle table and the query it self contains the ODI variable #EMP_NO.
    At the run time we thought of passing the variable values.
    table contains query like
    update table <table name> set <column name>= 5000 where emp_no = #EMP_NO
    We need to execute the sql query using a ODI procedure, to pick the sql query from table we use another variable #varSQLID and in the command on source tab wrote like
    select sql_query varSQL from emp_sql where query_id=#varSQLID
    Command on target
    #varSQL
    when ever I tried to execute I am getting error please let me know what changes are required .
    The question is whether it's possible to replace the variable value present in the above sql ?
    regards,
    Palash Chatterjee

    Thanks Siddhartha,
    Actually we have been doing the same, means half of the query has been kept in the table and rest is being added in the " command on source " tab of the procedure .
    But the problem is , the "where" condition is not same for all SQL queries,
    to provide 27 different sqls queries for 27 packages we have to create 27 procedures (as "where" condition may take other column values along with "EMPNO" for the JOIN condition ) .
    Any suggestion of keeing SQL along with the variable and storing it in the table may resolve our problem and work of 27 procedures can be performed by a single procedure .
    regards,
    Palash Chatterjee

  • Web Object Widget and replacing Variables in the URL

    I am using the new Web Object Widget in Captivate 7 and need some help with setting up the URL for the widget correctly.  If I hard-code a static web page address, the widget works fine.  The problems comes up when I need to slightly change the tail-end of the web address depending on who is taking the course.
    I need to dynamically append some variable information onto the web address that we will be calling such as:
    http://www.someplace.com/customizeforstudent.htm?Student_Name=$$studentName$$&Student_ID=$$studentId$$
    Is there any way to dynamically load the variable information into this widget when the student takes the course?
    I know that I was able to use the samples on captivatedev.com to do this web page variable replacement when I used JavaScript on a button so I know it can be done that way. 
    (see: http://captivatedev.com/2013/08/08/javascript-solution-launch-a-url-with-captivate-variabl es-as-parameters/ )
    The down-side of the captivatedev.com example is that it forces the web page to show up "outside" the course (either in a new window or it takes over the browser window the course is playing in.  I want to use the web object widget so I can stay "within" the normal flow of the course we are developing.
    I have been able to get the student name and student id from our LMS using JavaScript (thanks again to http://captivatedev.com).
    Whatever process we come up with needs to work not only with Flash, but also HTML5.
    Thank you for your time.
    Randy

    Hi BubbaRB and welcome to the forums.  I love it when people have great questions regarding integration.. and this is an area that Adobe Captivate needs to be better at!  It would be nice if the stock web page widget in Cp 7 had the ability to substitute Cp user variables in the URL to make for dynamic rendering of the web page, but unfortunately that's a limitation of the stock widget.
    The web page widget on CaptivateDev.com is capable of variable substitution in the URL.  You just need to enclose the variable with double dollar signs $$cpQuizInfoStudentID$$.
    http://captivatedev.com/2012/08/07/adobe-captivate-6-x-widget-web-page-widget/
    This widget works for SWF and HTML5 output for Cp 6 and 7 and there's a free trial available.

  • Replacement variable path

    Hi,
    Please some one guide me.
    what is replacement path? and how to do create it.
    Thanks,

    HI,
    Variable Customer Exit is used to check the authorizations to for login into BEx Report and to fill the selections Dynamically.
    check below link.
    Link: [http://help.sap.com/saphelp_nw04/helpdata/en/f1/0a56f5e09411d2acb90000e829fbfe/content.htm]
    Regards
    Daya Sagar

  • Replace variable with answer in Applescript

    Hello,
    I was wondering whether it is possible to replace (x or y) with an answer that is recieved via dialog box.
    I have a command: [sudo ifconfig en1 ether (x)]   X=Mac Address
    I know that the script would look like
    tell application "Terminal"
    do script "sudo ifconfig en1 ether (x)"
    activate
    end tell
    X changes every time
    how can I change X with a dialog box?
    Thanks

    Try this:
    display dialog "Please enter a value for x" default answer ""
    set x to text returned of the result as string
    set theShell to "sudo ifconfig en1 ether "
    do shell script (theShell & x) with administrator privileges
    If you actually want the results returned in Terminal rather the AppleScript editor, then try this instead:
    display dialog "Please enter a value for x" default answer ""
    set x to text returned of the result as string
    set theShell to "sudo ifconfig en1 ether "
    tell application "Terminal"
      activate
      do script (theShell & x)
    end tell

  • WLST Offline and Replacement Variables

    Hello.
    I'm having a problem where when I'm using WLST to create a domain from a template with an application in it, it writes the application out to the default <BEA_HOME>/user_projects/... as opposed to under the domain directory specified in the wl.writeDomain("/mydomains_dir/mynewdomain" ) command.
    The /AppDeployment/mystdapp/SourcePath is set to $APPLICATIONS_DIRECTORY$/myappsdir/mystdapp.war
    I even tried to change the $APPLICATIONS_DIRECTORY$ to $DOMAIN_HOME$
    but to no avail.
    Can you not use the tags?
    Is there an API I'm not finding the docs on that tell you how to set those tags to something other than the default before writing out the domain to get it to work???
    Any help at all would be very much appreciated. I've been searching the docs for days.
    tia,
    Ed Ludke
    Bank of America
    [email protected]
    (delete NOSPAM from above email address for valid address)

    Satya,
    Thanks so much for responding!
    I don't believe the problem is in the script because all I'm doing is loading a template and then writting it out as a domain to my own target dir.
    Regardless, below is a working sample of what I'm talking about.
    To use this script with the medrec template for example (found in $WL_HOME/common/templates/applications/medrec.jar), use the following entries in a show_rpl_var.properties file:
    ----Start of file----
    template=<your_wl_home>/common/templates/applications/medrec.jar
    appname=MedRecEAR
    domain_home=/some/target/dir/other/than/bea-user_projects/medrec
    ----End of file----
    Do this with a a clean installation (one where no samples have been run) or delete/rename the $BEA_HOME/user_projects/applications/medrec directory. Once you run it, look in $BEA_HOME/user_projects to see a brand new applications/medrec dir containing everything that was under the apps dir of the medrec.jar (if you look inside it).
    I believe this may be a bug, but I'm hoping that maybe there's something I should/could be doing in the wlst script prior to writting out the domain that just isn't documented anywhere (that I can find) to change what $APPLICATIONS_DIRECTORY$ defaults to.
    I know I can probably explicitly set the SourcePath to the fully qualified dir but you shouldn't really have too.
    Thanks again!
    Ed
    show_rpl_var.py (please note that the proper indentation is lost when posted so you'll have to manually add it back in):
    ----Start of Script----
    from java import util
    import wl
    #=======================================================================================
    # This Script loads a specified template that contains at least one app and then
    # displays (prints) the "SourcePath" for the specified app.
    # This script relies upon an acompaning properties file, named show_rpl_var.properties
    # that is in the following format:
    # template=./yourdomaintmpl.jar
    # appname=your_app
    # domain_home=/your_alt_domain_hom
    # Usage:
    # . $WL_HOME/server/bin/setWLSEnv.sh
    # java org.python.util.jython domainBuilder.py
    #=======================================================================================
    def main():
    buildProps = loadProperties()
    buildDomain( buildProps )
    #=======================================================================================
    #=======================================================================================
    def buildDomain( props ):
    #// Read in the template
    source = props[ "template" ]
    print "Reading from template " + source
    wl.readTemplate( source )
    print "Template read"
    #// Configure the default application.
    wl.cd( "/AppDeployment/" + props[ "appname" ] )
    print "App source path is: ", wl.get( "SourcePath" )
    #// Write the Domain.
    wl.setOption("OverwriteDomain", "true")
    target = props[ "domain_home" ]
    print "Writting domain to " + target
    wl.writeDomain( target )
    print "Domain written."
    #=======================================================================================
    #=======================================================================================
    def loadProperties():
    properties = {}
    #load domain instance vars
    prb = util.PropertyResourceBundle.getBundle( "show_rpl_var" )
    prbKeys = prb.getKeys()
    while( prbKeys.hasMoreElements() ):
    key = prbKeys.nextElement()
    properties[ key ] = prb.getString( key )
    #prb = util.PropertyResourceBundle.getBundle( "pd_simple_seed_wl900" )
    return properties
    main()
    -----End of Script-----

  • How to create replacement variable in my case?

    I have one time info in my cube call datefrom, now I want to calculate the days after I input date data into pop-up window, system will automatically calculate the days namely input date data minus datefrom data from cube. So how to handle this case. Pls give info step by step. Thanks!

    Hi,
    Try this:
    http://www.sd-solutions.com/documents/SDS_BW_Replacement%20Path%20Variables.html
    Rgs,
    I.R.K

  • Error while creating a Characteristic Variable with Replacement Path

    Hi all,
        I am trying to create the Characteristic Variable ZVLOWDT (Low Date') with Replacement Path on characteristic ZSTARTDT (Start Date) and it gives the error 'Source to replace 'Low Date' is not defined.
       I have created a User Entry Variable VAR_DATE (Start Date) with interval like '01/01/2009 - 01/15/2009'  and  Customer Exit variable ZVCPDAY (does some calculation based on the input of VAR_DATE) on the same ZSTARTDT characteristic. I want to get the 01/01/2009 (lower range date of the selection) into this Characteristic Variable ZVLOWDT. We are in BI 7.0 and the following are it's properties:
    General Tab:
    Description: Low Date
    Technical Name: ZVLOWDT
    Type of Variable: Characteristic Value
    Processing by: Replacement Path
    Reference Characteristic: ZSTARTDT Start Date
    Details Tab:
    Variable Represents : Single value
    Variable is: Mandatory
    Variable is Ready for Input : unchecked
    Replacement Path Tab: Replacement Rule
    Replace Variable with : Variable
    Variable : VAR_DATE
    Replace with : KEY
    Why I am getting this error, PLEASE ?
    Thanks,
    Venkat.

    Hi Khaja,
       We could derive a Variable value from another Variable with out Customer Exit. There is a white paper.
    First have the User Entry Variable (ZV_X) and it accepts the date range like '01/01/2009 - 01/31/2009'. Next create the Characteristic variable (ZV_Y) of Replacement Path for which source variable will be ZV_X and we could get the 'FROM Date' (01/01/2009) from the selection (ZV_X) into it (ZV_Y).
    While creating the Characteristic variable (ZV_Y) of Replacement Path, I didn't find my newly created ZV_X variable in the list of available variables under 'Variable' header in 'Replacement Path' tab and it is causing the error  'Source to replace variable ZV_Y is not defined'. How could I create the Characteristic variable of Replacement Path, PLEASE ?
    Thanks,
    Venkat.

  • Creating Variable with Replacement Path to get value from ANOTHER Variable

    Hi all,
        Is anyone has created the Variable with Replacement Path to get the value from another User Entry Variable, PLEASE ? 
    First created the User Entry Variable (ZV_X) and it accepts the date range like '01/01/2009 - 01/31/2009'. Next created the Characteristic variable (ZV_Y) of Replacement Path for which source variable will be ZV_X and we should get the 'FROM Date' (01/01/2009) from the selection (ZV_X) into it (ZV_Y).
    While creating the Characteristic variable (ZV_Y) of Replacement Path, I didn't find my newly created ZV_X variable in the list of available variables under 'Variable' header in 'Replacement Path' tab and it is causing the error 'Source to replace variable ZV_Y is not defined'. How could I create the Characteristic variable of Replacement Path for my requirement, PLEASE ?
    The following is from help.sap..com:
    Replace with Characteristic Value
    Text and formula variables with the processing type Replacement Path can be replaced with a corresponding characteristic value. In the variable editor, on the General tab page, you specify under Reference Characteristic the characteristic that is to be referenced by the replacement. On the Replacement Path tab page, you can choose whether the variable is replaced with the From or the To Value and with the Key or the Name of the characteristic value. You can also specify the Offset Start and Offset Length for the output.
    Replace with Variable
    Characteristic value variables, hierarchy variables, text variables, and formula variables with the Replacement Path processing type can take their values from a different variable.
    The following prerequisites need to be fulfilled:
    Variable
    ●      The variable must not be input-ready
    ●      The variable must represent a single value
    Source Variable
    ●      The source variable must not be a hierarchy node variable
    ●      The source variable must be input-ready
    ●      The source variable must be available in the query
    ●      The source variable must represent a single value or an interval
    In the variable editor, on the Replacement Path tab page, you specify the source variable from which the value is to be determined. The value is either determined from the key, the external attribute of the key, the description, or the attribute value. You can specify an Offset Start and an Offset Length for the output here. The variable is replaced on the variable screen upon each data release.
    Thanks,
    Venkat.

    Hi Eve,
    It is possible to connect the 2 queries using a Replacement Path characteristic variable. You would need to create the variable on the char whose values you want to pass from Q1 to Q2. The variable will be of type replacement path and you will need to enter the name of Q1 from which it will get the values. Make sure that you include this char in the query definition of Q1 and Q2. In Q2 you will restrict the characteristic using this variable. DO not use this variable (replacement path) in Q1.
    In your query properties check if you have turned on the checkmark for Release for OLE DB for OLAP (3rd tab). If the check mark is there, then remove it.
    We are using the scenario in a couple of places, and it works very well.
    Hope this helps...

Maybe you are looking for

  • Problems with Photoshop Elements 11

    I have a problem with Photoshop Elements 11, which i bought last week. Installing was completed according the instructions. When I started to use the program my one year old HP-computer with Windows 8.1 informed that there a failure in the Photoshop

  • Syncing photos from ipad 3 to new pc

    I recently bought a new computer and I am trying to sync my ipad to it. It sync'ed and the ipad has been backed up, but for some reasons its not syncing my new photos on it. I keep getting a message asking me if I want to " The ipad is synced with an

  • Wireless mighty mouse, mac pro

    How do I install apple wireless mighty mouse? no cd drive on mac pro

  • Program can't find device

    Help! I just got my Pre today and I am trying to download apps for it.  but for some reason the Webosquickinstall  can't find my device. I am hooked up to my computer and the phone is charging. What am I doing wrong? Post relates to: Centro (Sprint)

  • Why are ACR PSD files 10-20 percent larger than the same file resaved in PSD?

    Why are ACR > PSD files 10-20 percent larger than the same file resaved in PSD? I posted this many years ago and never found an answer. Now that my drives fill up quicker, I thought I might chase this question a little bit further. Same .CR2 saved wi