Accepting User Input

We have a report that shows all the departments and their revenues for the current year. The user should be able to filter the departments by revenue range.
i.e. The user can enter two values lower and higher limits. Say 100,000 and 500,000. Once he provides this input, the report will show only those departments having the revenue in this range.
Any suggestions on how this can be achieved ?

One option I could think of is using a Prompt with Control as Edit box.
But I don't see how I can specify < and > with (prompted values) prompt usage.
I stored the prompt value into a presentation variable named "test_value" and in the report I specified the filter criteria as <= @{test_value} but it is not taking the < condition. It only picks up records that are equal to the input value.
Edited by: user558238 on Apr 7, 2009 10:35 PM

Similar Messages

  • 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

  • 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();

  • 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

  • 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

  • Accepting user input in servlet

    Hi all,
    My problem is that in a servlet I am trying to connect to a database
    and need to prompt the user for username and password to connect to the database.My application requires that only users having a username and password can only connect to that database.
    Could you all pleasee help me in giving a good solution to solve this problem.

    It would be great how your servlet is invoked,
    (1) I see one easiest way could be that if an HTML form is calling your servlet it may have an input type textbox with Uname and Password which would be read by servlet [req.getParameter()] and connect to DB. This will help 2 loops to server and back to alert user to input password. If user doesnt enter Uname/pwd and presses submit servlet may redirect to same page with alert to fill.
    (2) The other way will require 2 loops to server, by calling servlet which roots back to client asking him to flll user password and goes back and connects to DB
    Please reply if im not clear
    Cheers

  • Accept user input in sql *plus 9.2.0.1.0

    Any body budy can get any idea about my sourcr code?
    I wrote below code in sql *plus
    accept p_hire_date1 date FORMAT 'DD-MON-YYYY' prompt 'ENTER hire date from:'
    accept p_hire_date2 date FORMAT 'DD-MON-YYYY' prompt 'ENTER hire date to:'
    DECLARE
    v_hd1 employees.hire_date%TYPE := TO_DATE(&p_hire_date1);
    v_hd2 employees.hire_date%TYPE := TO_DATE(&p_hire_date2);
    CURSOR emp_cursor IS
    SELECT e.last_name, e.first_name, e.hire_date, e.salary, d.department_name
    FROM employees e, departments d
    WHERE ((e.hire_date>=v_hd1) AND (e.hire_date<=v_hd2)) AND
    (e.department_id=d.department_id)
    ORDER BY e.first_name;
    emp_record emp_cursor%ROWTYPE;
    BEGIN
    DBMS_OUTPUT.ENABLE
    DBMS_OUTPUT.PUT_LINE(RPAD('Name',20) || RPAD('Hire Date',15) || RPAD('Salary',15) || RPAD('Dept. name',15));
    DBMS_OUTPUT.PUT_LINE(RPAD('-',4*15,'-'));
    FOR emp_record IN emp_cursor
    LOOP
    DBMS_OUTPUT.PUT_LINE(RPAD(emp_record.first_name || ' ' || emp_record.last_name,20) || RPAD(TO_CHAR(emp_record.hire_date),15) || RPAD(TO_CHAR(emp_record.salary),15) || RPAD(emp_record.department_name,15) );
    END LOOP;
    END;
    when I execute it I got this error
    SQL> /
    Enter value for p_hire_date2: 23
    accept p_hire_date1 date FORMAT 'DD-MON-YYYY' prompt 'ENTER hire date from:'
    ERROR at line 2:
    ORA-00900: invalid SQL statement
    any Idea?

    Your "accept" statement seems to be correct.
    Please change the declaration of v_hd1 and v_hd2 as below.
    v_hd1 employees.hire_date%TYPE := TO_DATE('&p_hire_date1','DD-MON-YYYY');
    v_hd2 employees.hire_date%TYPE := TO_DATE('&p_hire_date2','DD-MON-YYYY');
    Since p_hire_date1 and p_hire_date2 are date variables enter a valid date of format DD-MON-YYYY. You have entered 23 which is not a valid date.

  • Taking user input in a PL/SQL block

    Can someone tell me if it is possible to to take user input from within a PL/SQL loop? I mean I want that for each iteration in the loop, the program first take user input, and then based on that input, it perform specific operations. Then it repeats this process for each subsequent iteration of loop.
    If it is not possible in PL/SQL, is there any other alternative?
    Thanks.

    > I'm afraid I have no idea how to get the server to ask questions of the user,
    especially when it essentially operates in a kind of batch mode.
    Yep. To expand a tad on what Hans mentioned here.
    To accept input, the process needs to be able to read from this input device. Let's make it a keyboard. The PL/SQL process needs to read keyboard input.
    The keyboard is attached to a PC 1000km away in a branch office. The Oracle server process, running on a server in the data centre, executes this PL/SQL code.
    So now this PL/SQL process has to automagically hack its way across the network. It needs to remove the keyboard plug from that client PC. It somehow must get that keyboard rewired, across that 1000km, into the server platform at the data centre. And only then can the Oracle server process running that PL/SQL code read from that keyboard input device and accept user input.
    It is important, when developing in Oracle, to grasp just what client-server is and how it works. And not to confuse something like a SQL*Plus Client Process (submitting PL/SQL code) with the Oracle Server Process (parsing and executing that submitted PL/SQL code).

Maybe you are looking for

  • Error while creating Client Proxy from SE80

    Hi all, I am trying to create Client Proxy with WSDL through SE80. There is no involvement of XI to create the Proxy. I am using the option 'Local file' and uploading the wsdl file. But I am getting the following errors. "Proxy-Generierung: Fehler au

  • Xserve RAID issues

    Here's the situation - We have an Xserve RAID (left side full) with 2.27TB capacity and one hot spare. The RAID has been "un-mounting" itself. When connected, it does not appear in Disk Utility nor does it register as connected to the FC controller.

  • Resizable=true not working in window.open

    In window.open() in my jsp page window.open('http:/'+document.IPPBX_Form.ippbx.value, width=400,height=200,resizable=1 have tried resizeable=true, resizable=true,resizeable=1,resizable=1 but no hope. The maximizable button remains disabled. Help Plea

  • Touchpad scrolling is jerky

    I've got a Lenovo netbook with a Synaptics touchpad, using two finger scrolling in XP. Elsewhere in windows and in other applications the scrolling works fine, but in Firefox 19 it's annoyingly jerky. It's not a performance issue or a bug, just a set

  • Thinkvanta​ge Fingerprin​t Enrollment

    Im creating an image for the X61s and want the fingerprint enrollment to be optional.  I'd like to prevent the user enrollment from automatically starting after logon.  So, I need the fingerprint software installed, but dont want to be hassled for en