Generating DDL to accept user input parameters

I need generate DDL which will accept input parameters from user, for example, tablespace name for indexes. What is the best way to do it?
At present, I’ve created tablespace with name ‘&INDEX_TS’ in physical model and using it to create indexes. Is this a correct way to do it?
Also, &INDEX_TS appears within double quotes in generated DDL. Is there a way to get rid of double quotes?
I'm using v3.1

Hi,
I have just found out that there is a "substitution variable" facility within SQL*Plus and SQL Developer which allows runtime substitution when applying DDL.
Here are some extracts from the SQL Developer Help:
Script Runner
The SQL*Plus features available in the script runner include @, @@, CONNECT, EXIT, QUIT, UNDEFINE, WHENEVER, and substitution variables. For example, to run a script named c:\myscripts\mytest.sql, type @c:\myscripts\mytest in the Enter SQL Statement box, and click the drop-down next to the Execute Statement icon and select Run Script.
The following considerations apply to using the SQL Developer script runner:
For substitution variables, the syntax &&variable assigns a permanent variable value, and the syntax &variable assigns a temporary (not stored) variable value.
So if the name starts with &&, it will only prompt for the actual name the first time it appears.
Note that this still works if the name is presented as a quoted identifier, e.g.
TABLESPACE "&&INDEX_TS"
David

Similar Messages

  • Calling report from a form with user input parameters

    Hello,
    I am new to Oracle reports. I have an application coded in 6i. I am currently running the application in Oracle Forms Builder 9i. There are also few reports which are called from the forms. Since the application was developed in 6i, the report was called using Run_Product. The forms pass a set of user parameters to the report using the parameter list pl_id. The syntax used was Run_Product(REPORTS, 'D:\Report\sales.rdf', SYNCHRONOUS, RUNTIME,FILESYSTEM, pl_id, NULL);
    I learnt that the Run_product doesnt work in 9i and we need to use run_report_object. I have changed the code to use run_report_object and using web.show_document () i am able to run the report from the form. There are 2 parameters that need to be passed from forms to reports. The parameters are from_date and to_date which the user will be prompted to enter on running the form. In the report, the initial values for these parametes are defined. So, the report runs fine for the initial value always. But when i try to change the user inputs for the form_date and to_date, the report output doesnt seem to take the new values, instead the old report with the initial values(defined in the report) runs again.
    Can someone give me the code to pass the user defined parameters to the report from the forms? I have defined a report object in the forms node as REPTEST and defined a parameter list pl_id and added form_date and to_date to pl_id and used the following coding:
    vrepid := FIND_REPORT_OBJECT ('REPTEST');
    vrep := RUN_REPORT_OBJECT (vrepid,pl_id);
    But this doesnt work.
    Also, Should the parameters defined in the forms and reports have the same name?

    Thanks for the quick response Denis.
    I had referred to the document link before and tried using the RUN_REPORT_OBJECT_PROC procedure and ENCODE functions as given in the doc and added the following SET_REPORT_OBJECT_PROPERTY in the RUN_REPORT_OBJECT_PROC :
    SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_OTHER,' FROM_DATE='||:BLK_INPUT.FROM_DATE||' TO_DATE='||:BLK_INPUT.TO_DATE||' paramform=no');
    But this also dint work. Please help me understand what difference does setting paramform=no OR paramform=yes make?
    In the report, i have defined the user parameters as FROM_DATE and TO_DATE respectively so that they match the form datablock BLK_INPUT items FROM_DATE and TO_DATE.
    My WHEN_BUTTON_PRESSED trigger is as below:
    DECLARE
    report_id report_object;
    vrep VARCHAR2 (100);
    v_show_document VARCHAR2 (2000) := '/reports/rwservlet?';
    v_connect VARCHAR2 (30) := '&userid=scott/tiger@oracle';
    v_report_server VARCHAR2 (30) := 'repserver90';
    BEGIN
    report_id:= find_report_object('REPTEST');
    -- Call the generic PL/SQL procedure to run the Reports
    RUN_REPORT_OBJECT_PROC( report_id,'repserver90','PDF',CACHE,'D:\Report\sales.rdf','paramform=no','/reports/rwservlet');
    END;
    ... and the SET_REPORT_OBJECT_PROPERTY code in the RUN_REPORT_OBJECT_PROC procedure is as:
    PROCEDURE RUN_REPORT_OBJECT_PROC(
    report_id REPORT_OBJECT,
    report_server_name VARCHAR2,
    report_format VARCHAR2,
    report_destype_name NUMBER,
    report_file_name VARCHAR2,
    report_otherparam VARCHAR2,
    reports_servlet VARCHAR2) IS
    report_message VARCHAR2(100) :='';
    rep_status VARCHAR2(100) :='';
    vjob_id VARCHAR2(4000) :='';
    hidden_action VARCHAR2(2000) :='';
    v_report_other VARCHAR2(4000) :='';
    i number (5);
    c char;
    c_old char;
    c_new char;
    BEGIN
    SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_COMM_MODE,SYNCHRONOUS);
    SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_FILENAME,report_file_name);
    SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_SERVER,report_server_name);
    SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_DESTYPE,report_destype_name);
    SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_DESFORMAT,report_format);
    SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_OTHER,' FROM_DATE='||:BLK_INPUT.FROM_DATE||' TO_DATE='||:BLK_INPUT.TO_DATE||' paramform=no');
    hidden_action := hidden_action ||'&report='||GET_REPORT_OBJECT_PROPERTY(report_id,REPORT_FILENAME);
    hidden_action := hidden_action||'&destype='||GET_REPORT_OBJECT_PROPERTY(report_id,REPORT_DESTYPE);
    hidden_action := hidden_action||'&desformat='||GET_REPORT_OBJECT_PROPERTY (report_id,REPORT_DESFORMAT);
    hidden_action := hidden_action ||'&userid='||get_application_property(username)||'/'||get_application_property(password)||'@'||get_application_property(connect_string);
    c_old :='@';
    FOR i IN 1..LENGTH(report_otherparam) LOOP
    c_new:= substr(report_otherparam,i,1);
    IF (c_new =' ') THEN
    c:='&';
    ELSE
    c:= c_new;
    END IF;
    -- eliminate multiple blanks
    IF (c_old =' ' and c_new = ' ') THEN
    null;
    ELSE
    v_report_other := v_report_other||c;
    END IF;
    c_old := c_new;
    END LOOP;
    hidden_action := hidden_action ||'&'|| v_report_other;
    hidden_action := reports_servlet||'?_hidden_server='||report_server_name|| encode(hidden_action);
    SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_OTHER,'pfaction='||hidden_action||' '||report_otherparam);
    -- run Reports
    report_message := run_report_object(report_id);
    rep_status := report_object_status(report_message);
    IF rep_status='FINISHED' THEN
    vjob_id :=substr(report_message,length(report_server_name)+2,length(report_message));
    message('job id is'||vjob_id);pause;
    WEB.SHOW_DOCUMENT(reports_servlet||'/getjobid'||vjob_id||'?server='||report_server_name,' _blank');
    ELSE
    --handle errors
    null;
    END IF;
    In the code - " hidden_action := hidden_action ||'&'|| v_report_other; " in the RUN_REPORT_OBJECT_PROC procedure above, how do i make sure that the v_report_other variable reflects the user input parameters FROM_DATE and TO_DATE ??? v_report_other is initialised as v_report_other VARCHAR2(4000) :=''; in the procedure. Will ensuring that the v_report_other contains the user input parameters FROM_DATE and TO_DATE ensure that my report will run fine for the input parameters?
    Thanks in advance.
    Edited by: user10713842 on Apr 7, 2009 6:05 AM

  • SQL*Developer 2.1 - Not Generating DDL for Different Users

    Using SQL*Developer Version 2.1.0.63 I get an error trying to generate DDL from another user, that has access to many other schemas. It looks to me like Sql Developer is calling the DBMS_METADATA package from within other PL/SQL.
    I am receiving the following error:
    ORA-31603: object "ACCOUNT_TYPE_LKP" of type TABLE not found in schema "POR_OWN"
    ORA-06512: at "SYS.DBMS_SYS_ERROR", line 105
    ORA-06512: at "SYS.DBMS_METADATA", line 3241
    ORA-06512: at "SYS.DBMS_METADATA", line 4812
    ORA-06512: at line 1
    I would receive these same errors in SQL Developer 1.5, but the DDL would still generated. It was picking something up, even though it had an error.
    Our DBA has not been able to provided a work around. He says you have to login directly as the owner of the objects to use dbms_metdata in this fashion.
    Is there any work around for this? I really need to be able to get DDL and I do not want to go back to 1.5 (I like the other new features of 2.1).
    Thanks,
    Tom

    We have several users currently using SQL Navigator and/or TOAD. We would like them to switch to SQL developer, but part of their job is to view the source of views in another schema. They have select privileges on the underlying tables and are able to see the source using other tools. Using SQL Developer, they receive on ORA-31603 because it's calling dbms_meta. Note ID 1185443.1 describes the issue and suggests granting the users the SELECT_CATALOG_ROLE.
    We are hesitant about granting this role to these users which allows access to ever 1,700 objects, plus execute privileges to 4 objects.
    Support indicated that Enhancement Request 8498115 addresses this issue.
    Is this something that may be addressed in the next release?
    Thanks,
    Paul

  • How to accept user inputs from  sql script

    I want to create Tablespace useing sql script , but the location of the data file I need accept from user . (to get the location of the data file ) .
    How can I accept user input from pl/sql .
    Example :
      CREATE TABLESPACE  TSPACE_INDIA LOGGING
         DATAFILE 'H:\ORACLE_DATA\FRSDB\TSPACE_INDI_D1_01.dbf'
         SIZE 500M  AUTOEXTEND ON NEXT  1280K MAXSIZE UNLIMITED
         EXTENT MANAGEMENT LOCAL;here I need to accept location of the datafile from user ie : 'H:\ORACLE_DATA\FRSDB\TSPACE_INDI_D1_01.dbf'

    Hi,
    Whenenever you write dynamic SQL, put the SQL text into a variable. During development, display the variable instead of executing it. If it looks okay, then you can try executing it in addition to displaying it. When you're finished testing, then you can comment out or delete the display.
    For example:
    SET     SERVEROUTPUT     ON
    DECLARE
        flocation     VARCHAR2 (300);
        sql_txt     VARCHAR2 (1000);
    BEGIN
        SELECT  '&Enter_The_Path'
        INTO    flocation
        FROM    dual;
        sql_txt :=  'CREATE TABLESPACE SRC_TSPACE_INDIA LOGGING
         DATAFILE' || flocation || ' "\SRC_TSPACE_INDI_D1_01.dbf" ' || '
         SIZE 500M  AUTOEXTEND ON NEXT  1280K MAXSIZE UNLIMITED
         EXTENT MANAGEMENT LOCAL ';
        dbms_output.put_line (sql_txt || ' = sql_txt');
    --  EXECUTE IMMEDIATE sql_txt;
    END;
    /When you run it, you'll see something like this:
    Enter value for enter_the_path: c:\d\fubar
    old   5:     SELECT  '&Enter_The_Path'
    new   5:     SELECT  'c:\d\fubar'
    CREATE TABLESPACE SRC_TSPACE_INDIA LOGGING
         DATAFILEc:\d\fubar
    "\SRC_TSPACE_INDI_D1_01.dbf"
         SIZE 500M  AUTOEXTEND ON NEXT  1280K MAXSIZE
    UNLIMITED
         EXTENT MANAGEMENT LOCAL  = sql_txt
    PL/SQL procedure successfully completed.This makes it easy to see that you're missing a space after the keyword DATAFILE. There are other errrors, too. For example, the path name has to be inside the quotes with the file name, without a line-feed between them, and the quotes should be single-quotes, not double-quotes.
    Is there some reason why you're using PL/SQL? In SQL, you can just say:
    CREATE TABLESPACE SRC_TSPACE_INDIA LOGGING
    DATAFILE  '&Enter_The_Path\SRC_TSPACE_INDI_D1_01.dbf'
    SIZE 500M  AUTOEXTEND ON NEXT  1280K MAXSIZE UNLIMITED
    EXTENT MANAGEMENT LOCAL;though I would use an ACCEPT command to given a better prompt.
    Given that you want to use PL/SQL, you could assign the value above to sql_txt. If you need a separate PL/SQL variable for flocation, then you can assign it without using dual, for example:
    DECLARE
        flocation     VARCHAR2 (300)     := '&Enter_The_Path';The dual table isn't needed very much in PL/SQL.
    Edited by: Frank Kulash on Jan 10, 2013 6:56 AM

  • Accepting user input and executing a PL/SQL block using it

    Hi All,
    I am working on a requirement wherein I have to accept values from the user for the various arguments to be supplied to a PL/SQL block and then execute it using these values. For now, I am using the following logic:
    PROMPT Enter value for the Category
    ACCEPT cCategory CHAR PROMPT 'Category:'
    DECLARE
    cCategry CHAR(1) := '&cCategory';
    BEGIN
    DBMS_OUTPUT.PUT_LINE('The value of the Category as entered by you is' || cCategory);
    END;
    PROMPT Press y if you want to proceed with the current values, or press n if you want to re-enter the values
    ACCEPT cChoice CHAR Prompt 'Enter y or n:'
    DECLARE
    cCategry CHAR(1) := '&cCategory';
    sErrorCd VARCHAR2(256);
    sErrorDsc VARCHAR2(256);
    BEGIN
    IF '&cChoice' = 'y'
    THEN
    DBMS_OUTPUT.PUT_LINE('Starting with the process to execute the stored proc');
    --- schema1.package1.sp1(cCategry, sErrorCd, sErrorDsc);
    --- DBMS_OUTPUT.PUT_LINE('Error Code :' || sErrorCd);
    --- DBMS_OUTPUT.PUT_LINE(' Error Description :' || sErrorDsc);
    ELSIF '&cChoice' = 'n'
    THEN
    Now I want that the proc again start executing in the loop from the 1st line i.e. PROMPT Enter value for the Category. However i see that this is not possible to do that PROMPT statements and accepting user inputs execute only on the SQL prompt and not inside a PL/SQL block.
    Is there an alternate method to establish this?
    Thanks in advance.

    Hi,
    You can write a genric procedure to achive the desired output. Pass 'Y' or 'N' in the procedure.
    Call that procedure in simple pl/sql block during runtime using substituton operator.
    For ex
    create or replace procedure p1(category_in in varchar2)
    IS
    BEGIN
    if (category_in='Y')
    then
    prcdr1()
    /** Write your logic here ***/
    elsif(category_in='N') then
    prcdr2()
    /** write your logic here***/
    end if;
    exception
    /***write the exception logic ***/
    end p1;
    Begin
    p1('&cat');
    end;Regards,
    Achyut K
    Edited by: Achyut K on Aug 6, 2010 5:20 AM

  • Accept user input

    Dear All,
    How do we accept user input in isql*plus in 9i? I am writing pl/sql code that requires user input but i get the message:
    SP2-0850: Command "accept" is not available in iSQL*Plus
    the figure you requested is:
    PL/SQL procedure successfully completed.

    Also you can use some commands at sqlplus to add/delete/append lines of sql buffer.
    append (a)
    insert (i)
    del (d)
    run (r)iline (l) nth line (1l or 2l ...)
    change c/<old value>/<new value>
    etc.,
    << Sample >>
    SRI>select * from bonus;
    ENAME JOB SAL COMM
    Sri DBA 1000 123
    Sam Sales 1022 10
    Elapsed: 00:00:00.00
    SRI>c/*/ename,job
    1* select ename,job from bonus
    SRI>r
    1* select ename,job from bonus
    ENAME JOB
    Sri DBA
    Sam Sales
    Elapsed: 00:00:00.01
    SRI>i
    2 where ename = 'Sri';
    ENAME JOB
    Sri DBA
    Elapsed: 00:00:00.01
    SRI>;
    1 select ename,job from bonus
    2* where ename = 'Sri'
    SRI>2
    2* where ename = 'Sri'
    SRI>DEL
    SRI>;
    1* select ename,job from bonus
    -Sri

  • Failed to accept user input when run report on Web

    I've testing a report with one input parameter. It's a date with default current date. It is done by using SQL 'select sysdate from dual;' has been added to before form trigger. User is allowed to input any date other than the default sysdate before submitting the report. The report works fine when run in report builder, but it's failed to accepted user input date when called through web browser. The report still uses the current date as SQL parameter rather than user input date.
    Can anyone help me to fix this bug?
    The report is develped by Oracle 9i and is saved and run in .rdf format.

    I created a report with a user defined parameter p_date of DATE type. In the layout model, I created a field with p_date as data source. In the before form trigger, I put
    'select sysdate into :p_date from dual;
    I run the report through rwservlet:
    http://host:port/reports/rwservlet?report=datetest.rdf&destype=cache&desformat=html&userid=scott/tiger@orcl&paramform=yes
    In the html parameter form, I change the date from default current date to a future date and that date is shown in the final report.
    So I can't reproduce the bug.
    One thing you can try it to turn on reports server trace file, see what command line is sent to reports server when you submitting the parameter form.
    Thanks,
    -Shaun

  • Acrobat Batch Plug-in and accessing user input parameters

    I have written a plug-in for acrobat 9 and need to retreive the value stored in the "select output location" field from the default "edit batch sequence" dialog.
    How can I get a handle to the "edit batch sequence" dialog and the dialog's user input fields and their respective values?

    I don't know if this will help you out, but remember that a batch sequence (.sequ) is finally just a plain-text file.
    If you know the name of the batch and the location of the sequences folder, you can probably write a small tool to read it in, parse it and figure out the output folder yourself.
    For example, here's a very basic batch sequence I've created. It just calls a JS method on each file:
    <</Commands [/c <<    /0 [/c <<        /Config [/c <<            /UIPolicy [/i 3]
    >>]
            /HandlerName [/a /JavaScript]
            /Params [/c <<            /ScriptCode [/t (collectFilePaths\(this\);)]
                /ScriptName [/t ()]
    >>]
            /Title [/t (Execute JavaScript)]
    >>]
    >>]
    /Input [/c <<    /FileVariation [/i 1]
        /PreselectedFolderPath [/c <<        /DI [/s (/C/Batch In)]
            /DIText [/t (/C/Batch In)]
            /FS [/a /DOS]
    >>]
        /SourceFileOptions [/c <<        /Formats [/c <<>>]
    >>]
    >>]
    /Output [/c <<    /AddToBaseName [/b false]
        /DontOverwrite [/b false]
        /FileVariation [/i 2]
        /InsertAfterBaseName [/t ()]
        /InsertBeforeBaseName [/t ()]
        /OptimizePDF [/b true]
        /PreselectedFolderPath [/c <<        /DI [/s (/C/Batch Out)]
            /DIText [/t (/C/Batch Out)]
            /FS [/a /DOS]
    >>]
        /PresetName [/t (Standard)]
        /RunPDFOptimizer [/b false]
    >>]
    >>
    The input and output folders ("C:\Batch In" and "C:\Batch Out\") are plainly visible in the code.

  • After "Hello World" - my first adventure in accepting user input

    Hey
    I'm trying to teach myself java and I'm attempting to move on from printing hello world to the screen :)
    I've written the following:
    import java.io.*;
    public class firstapp {
         int value1,
              value2,
              result;
         public static int add(int value1, int value2){
             return value1 + value2;
         public static void main(String args[]){
              int value1,
                        value2,
                        result;
              BufferedReader reader;
              reader = new BufferedReader(new InputStreamReader(System.in));
              //try block
              try{
                   System.out.println("Please type the first number");
                   value1 = reader.read();
                   System.out.println("Please type the second number");
                   value2 = reader.read();
                   result = add(value1,value2);
                   System.out.println("Added together they equal " + result);
         catch (IOException ioe){
              System.out.println("Something bad happened");{
         }It doesnt do what I expected though. It prompts for the first number which i enter. It then prints "Please type the second number" but doesnt accept any input and goes on to print "Added together they equal 62" (this is when 1 is entered as the first number).
    Im so new to this so excuse it being the most basic of basic questions. But where is it getting 62 from?
    Thanks

    BufferedReader.read() isn't the best method for this. It reads a single character, which you store as an int. If you entered "5" for example, the ascii value of 5 is being stored, not the value 5. The second read() call is most likely reading the carriage return, so it adds 53 and 13, and prints that out, for example. If you have version 1.5 or better, use the Scanner class instead, it has a nextInt() method that does what you want.

  • URGENT!.....accepting user input and string conversion

    I have a problem with a text-based menu I am trying to create for a Shape class with rectangle, circle, etc... subclasses below it...here is a code clip
    //The menu choices given to the user.
              System.out.println("Please select which shape you would like to create:\n");
              System.out.println("(1)Rectangle");
              System.out.println("(2)Square");
              System.out.println("(3)Circle");
              System.out.println("(4)Ellipse");
              System.out.println("(5)Exit the program\n");
              System.out.print("Enter your choice (1,2,3,4 or 5): ");
         menuChoice=(char)System.in.read();
    switch(menuChoice) {
    case '1':                              
    System.out.println("\nTo create a rectangle, please enter the following dimensions below (integers only)...\n");                    
         System.out.print("Center X co-ordinate = ");
              while((x=(char)System.in.read()) !='\n')
              CentXBuf.append(x);     
         System.out.print("Center Y co-ordinate = ");
              while((y=(char)System.in.read()) !='\n')
              CentYBuf.append(y);
    The above works fine, however, when the the user inputs the menu choice, it does not let me input the center x co-ordinate and goes on to the second input of the center y co-ordinate then the program crashes with a NumberFormatException
    I tried to replace
         menuChoice=(char)System.in.read();
    with
         while((z=(char)System.in.read()) !='\n'){
              zBuff.append(z);
         String v = new String(zBuff);
         int menuChoice = Integer.valueOf(v).intValue();
    but the above itself gives me a NumberFormatException also!
    What do I do?!?!

    Try this:
    BufferedReader reader = new BufferedReader(
    new InputStreamReader(System.in)
    String input = reader.readLine();

  • Generate charts based on user input

    Hello!
    My goal is to create an application in which a user would enter information (specifically in the form of numbers and financials). The final output would create a page / document that shows summary of the data and also manipulates the data into bar and pie charts. (We are trying to create side by side comparison charts based on user input.)
    I have a subscription to the Creative Cloud, so I have access to a large % of Adobe products. Do you have any suggestions on what application I should use for this project? The final output could be PDF or Web based.
    Thank you!
    Bethany

    Hi Bethany,
    You may check out Adobe FormsCentral at https://www.acrobat.com/formscentral/en/home.html and see if that's what you need. You can create forms using Adobe FormsCentral to collect user input and user responses will be displayed in charts.
    Thanks,
    Wenlan

  • Accepting User input in SQL*Plus

    I am writing a SQL script in SQL*Plus that accepts a value from the user and plugs that value into a variable that exist in several locations outside of the PL/SQL block.
    I am able to do this, yet everytime this variable is encountered, the user is prompted for input. I would like to have the user prompted only once at the beginning and then use that value throughout. This seems like a simple task, yet I cannot get it to work.
    Any help would be greatly appreciated.

    You can use &&<variable_name> and it will define the variable and use it throughout the SQL code.

  • Accepting user input half-way through a script.

    Short version of the question:
    I'm trying to output a few lines to the screen and then ask the user for some input. Depending on what is input, one of two things can happen. How can I ask the user for input half-way through running a script? I've tried the '&' substitution variable, but instead of prompting half-way through, it prompts at the beginning of the script, hence confusing everything!
    Long version of the question:
    I'm making a game where 5 unique cards are taken from a pack of 52 cards. So far this is working fine. What then happens is the first card is displayed to the user and then the user is prompted for an 'H' or an 'L' to see if they think the next card will be of a higher or lower value than the one displayed.
    The next card is then displayed, and if correct the above is repeated. This is done 4 times in total before a game is won.
    My problem lies in prompting the user for input.
    I've tried to use ACCEPT and PROMPT to ask the user for input after each card is displayed and have used &input in the code to see what the user has input, but instead of prompting after each card, it simply prompts the user for input right at the beginning of the script - even though the ACCEPT and PROMPT code is where I would like it.
    How can I do what I would like to? Do I use &substitution variables? If so, what method do I use to prompt the user? I've searched for ages and haven't found anything! From what I can see, it looks as though this may not be possible, but I'm sure I'm wrong on this!
    Thanks for reading.

    Hi,
    Check the following. If it helps you, then fine.
    Step 1: Script file "sample.sql" contained the following
    ACCEPT dno PROMPT "Enter Department Number: "
    SELECT ename, deptno FROM emp WHERE deptno = &dno;
    ACCEPT salary PROMPT "Enter Basic Salary: "
    SELECT ename, sal FROM emp WHERE sal > &salary;
    Step 2: @sample.sql The output given below
    SQL> @s
    SQL> ed s
    SQL> @s
    Enter Department Number: 10
    old 1: SELECT ename, deptno FROM emp WHERE deptno = &dno
    new 1: SELECT ename, deptno FROM emp WHERE deptno = 10
    ENAME DEPTNO
    JONES 10
    KING 10
    JAMES 10
    Enter Basic Salary: 2500
    old 1: SELECT ename, sal FROM emp WHERE sal > &salary
    new 1: SELECT ename, sal FROM emp WHERE sal > 2500
    ENAME SAL
    SCOTT 37800
    KING 5250.58
    FORD 3015.55
    Regards,
    Sailaja

  • SQL LOGIC - How to accept USER input and use that data in SQL Logic?

    Hello Experts
    Can anyone of you please explain in detail how to acheive the above task am a begginner, it would be great help for me.
    Thanks in Advance.

    Hi,
    You mean to say, you need to use inputs from Data manager Prompts in your Script Logic.
    From Help File
    You can use the EvDTSModifyPkg task to dynamically pass a text string to logic in Data Manager.  For example, a user who wishes to dynamically pass a text string representing a year (which is a portion of the *XDIM_MEMBERSET instruction) could use the following steps:
    Using the EvDTSModifyPkg task, prompt for the year, i.e., PROMPT(TEXT,%TEXT%,"select a year")
    Pass the returned %TEXT% to the FormulaScript of the RunLogic task as follows: TASK(RUNLOGIC,FORMULASCRIPT,"*FUNCTION MYYEAR=%TEXT%u201D)
    In the Data Manager logic, use the dynamically created function as follows: *XDIM_MEMBERSET TIME=MYYEAR.INPUT.
    The logic name in the RunLogic task must be specified with the .LGF extension to enforce its validation at run time.
    BPC NW 2.0 Version Works differently.
    Hope this Helps,
    Kranthi

  • Accepting user input and then running grant statements

    Hi I have a script which creates a database, at the end of this script I need to change user, and then run a number of grants. I need to accept the name of the schema to make the grants to from the user. The code I have been trying to use is below
    --Prompt for portal password and connect as portal
    connect portal
    --Issue grants for portal apis
    PROMPT 'Enter the schema name'
    ACCEPT schema
    @provsyns.sql &schema
    PROMPT 'Enter the schema name'
    ACCEPT schema
    grant select on WWSEC_PERSON to &&schema;
    PAUSE
    grant select on WWSEC_GROUP$ to &&schema;
    PAUSE
    grant execute on wwctx_api_private to &&schema;
    grant execute on pkg_oid to &&schema;
    grant execute on pkg_error_handling to &&schema;
    UNDEFINE schema
    When I run the code I get and ORA-00987: missing or invalid username(s)
    Can anyone help me please?
    Many thanks,
    Danny

    Hi,
    You can write a genric procedure to achive the desired output. Pass 'Y' or 'N' in the procedure.
    Call that procedure in simple pl/sql block during runtime using substituton operator.
    For ex
    create or replace procedure p1(category_in in varchar2)
    IS
    BEGIN
    if (category_in='Y')
    then
    prcdr1()
    /** Write your logic here ***/
    elsif(category_in='N') then
    prcdr2()
    /** write your logic here***/
    end if;
    exception
    /***write the exception logic ***/
    end p1;
    Begin
    p1('&cat');
    end;Regards,
    Achyut K
    Edited by: Achyut K on Aug 6, 2010 5:20 AM

Maybe you are looking for

  • Use more than one Catalog from ECC 6

    At the configuration point in ECC 6 Materials Management ... Web Services: ID and Description I can describe more than one catalog URL address , but the user see in transaction ME21N or ME51N only that catalog with the default flag. Is it possible to

  • Clean install of Mavericks, now cannot access Time Machine backups

    I just performed a clean install of Mavericks (10.9.1), but now I cannot access my previous backups under Mountain Lion (10.8.5). The new installation recognizes the TM disk just fine, and I can enter TM, but all of my old backups are blacked out. In

  • Windows XP Pro will not connect to 6500A (ethernet only) printer

    I have printer working for Win 7, Ubuntu 10 & Mint 10 but after running HP wizard on the XP machine it will not see printer. I have tried connecting via printer IP and host name using advanced box. I can ping the printer address from the XP box and a

  • Lence flare plugin for premiere pro cc

    I need some help finding a great lence flare plugin 3d for premiere pro cc. Can somebody direct me to the right stuff ..   Thanks .

  • After downloading itunes 10.5.2 my playlists are gone

    After downloading itunes 10.5.3 my playlists folder is empty and they are not showing in any other music related folders.  I will not try to sync my ipod to get them back in itunes, for they too may disappear.