Prompt For User Input in SQL Developer

I am using the '&' in a very basic SQL select script, but I do not get a prompt for my input. However, i have used the '&' in update scripts and it does prompt me.
For example:
select DCC_DESCRIPTION
from S_TBLDTMINOR
where DCC_DTMINOR = &Minor;
Gives an ORA-01008 error (not all variables bound).
If it's a varchar field and I use '&Minor' - it executes with no error, but does not prompt for data. Please note:  this script works when it's run in SQL*Plus, but not in SQL Developer.
If I execute:
update S_TBLDTMINOR
set DCC_DESCRIPTION = 'Mark & Wilson'
where DCC_DTMINOR = 'AAA';
It does prompt me for a value (but I do not want it to).
So I know prompting works in SQL Developer, but it does not work in select statements.
Is this a configuration setting I can change in SQL Developer? I know I can use the escape in the update statement to avoid the prompt, but I'm not concerned with that. I'm trying to get the prompting to work in the select statement.
Edited by: user12289057 on Feb 23, 2012 11:17 AM

Hi user12289057,
1/Not sure what your testcase is (including table definition), I was trying to reproduce with:
select * from dual where dummy = '&myin'
2/Try
undefine Minor
to ensure Minor is not already set.
3/Minor may need to be quoted if it is a string.
Short blog post on substitution and bind variables.
http://totierne.blogspot.com/2010/04/substitution-and-bind-variables.html
-Turloch
SQLDeveloper team.

Similar Messages

  • How to prompt for user input in PL/SQL

    How do I prompt for user input in PL/SQL?
    I am writing a piece of code where the user may choose, by clicking either of three buttons on an alert, to have the system assign a value to a variable, to input a value or to do neither?
    If the user chooses to input the value I want to update a set of database fields with the value.
    I have thought about showing a view where the value may be entered into a field displayed on that view. The value will be assigned to the variable by the user clicking a command button. The question I have in this case though, is whether, after the command button is clicked, control will be passed back to the code that called the view in the first place?
    Edited by: desgordon on Sep 3, 2008 10:33 AM

    desgordon wrote:
    How do I prompt for user input in PL/SQL?
    I am writing a piece of code where the user may choose, by clicking either of three buttons on an alert, to have the system assign a value to a variable, to input a value or to do neither?OK, you're doing that in Forms...
    >
    If the user chooses to input the value I want to update a set of database fields with the value.Write PL/SQL procedure for this purpose...
    >
    I have thought about showing a view where the value may be entered into a field displayed on that view. The value will be assigned to the variable by the user clicking a command button. The question I have in this case though, is whether, after the command button is clicked, control will be passed back to the code that called the view in the first place?Not clear what you mean with view?
    But if you call your procedure in that button then yes 'control will be passed back to the code'...
    Cheers!
    Edited by: Faust on Sep 3, 2008 7:57 PM
    Too slow...

  • "catching" a prompt for user input and answering it through zenity?

    I'm trying to write a script (or multiple scripts) that will allow me to use command-line only applications via user defined actions in my file manager without having to open a terminal. Now I realize this basic functionality is already available, but as it stands I am unable to respond to command-line prompts for user input without opening a terminal. Is it possible to write a shell script that would act as a wrapper and allow me to use zenity (or another popup program) to respond to such queries?
    For example if I used a command-line program that prompted me for a password, could I "catch" that prompt with a shell script and answer it through another program, such as zenity?
    Last edited by falconheart (2011-01-16 22:37:25)

    The easier way to do this is to collect the info with zenity first, then pass it on the command line.  If the program insists on prompting, then you could try feeding it the info with redirection if it accepts it from stdin.  For example
    command < info.txt
    where info.txt is a temp file created by your script which contains whatever you want entered into the prompts.  This will work in some cases.

  • How to prompt for user input in Forms

    How do I prompt for user input in Forms?
    I am writing a piece of code where the user may choose, by clicking either of three buttons on an alert, to have the system assign a value to a variable, to input a value or to do neither?
    If the user chooses to input the value I want to update a set of database fields with the value.
    I have thought about showing a view where the value may be entered into a field displayed on that view. The value will be assigned to the variable by the user clicking a command button. The question I have in this case though, is whether, after the command button is clicked, control will be passed back to the code that called the view in the first place?

    Desgordon,
    This can be accomplished by displaying your message to the user using an Alert. I use 3 different Alerts (Note, Caution and Stop) in my forms and they are inherited from a central source file (such as an Object Library or a Template Form) so they can be used by all of my Forms. You can set the text of the Alert using the SET_ALERT_PROPERTY() built-in and capture what button the user presses with the SHOW_ALERT() built-in. Additionally, if you need more than one button to be displayed in an alert, you use the SET_ALERT_BUTTON_PROPERTY() built-in to rename the default button or to add up to a total of three buttons in the alert. Here's an example:
    DECLARE
       Alert_ID       ALERT;
       v_AlertType    VARCHAR2(10) := 'CAUTION';
       v_AlertTitle     VARCHAR2(25);
       v_AlertText    VARCHAR2(150);
       n_AlertButton  NUMBER;
    BEGIN
       v_AlertTitle := 'Title of Alert';
       v_AlertText := 'This is message to the user.';
       /* Code leading up to the decision point. */
       alert_id := FIND_ALERT(v_AlertType);
       /* Note: I only set the Label of Button 2 because the default button 1 label is 'OK' */
       SET_ALERT_BUTTON_PROPERTY(v_AlertType, ALERT_BUTTON2, LABEL, 'Cancel');
       SET_ALERT_PROPERTY(Alert_ID, v_AlertTitle, v_AlertText);
       n_AlertButton := SHOW_ALERT(Alert_ID);
      /* Now I can test the value of n_AlertButton for 1 or 2 to find out what button the user selected. */
      IF ( n_AlertButton = 1 ) THEN
         /* Do something, because the user selected 'OK' */
      ELSE
         /* It is assumed at this point that the user selected 'CANCEL' */
         /* Stop processing any further. */
         RAISE form_trigger_error;
      END IF;
    END:Hope this helps.
    Craig...
    -- If my response or the response of another answers your question, please mark the response accordingly. Thanks!

  • How to force sql developer to prompt for user input for every execution ?

    Hi Folks,
    Environment: Oracle 11g (on Windows 7)
    SQL Developer: *3.1.07*
    I am executing a PL/SQL code off Sql Developer. The code uses substitution variables to prompt user for input. However,I am only prompted for the user input for the very first run of the code. For the subsequent executions, the code simply picks up the user input from the very first run. This behavior persists for all subsequent runs of the code.
    I have executed the same piece of code from SQL*PLUS and the behavior seems normal (i.e. I am prompted for fresh input for every execution)
    How can flush out the old user input so I can be prompted for new user input for every run of the code in sql developer?
    Thanks in advance
    rogers42

    Hi Rogers42,
    1/try
    undefine
    undefine fred
    select '&&fred' from dual;
    [run this multiple times]
    [prompts gere]
    old:select '&&fred' from dual
    new:select 'a' from dual
    'A'
    a
    [prompts here]
    old:select '&&fred' from dual
    new:select 'b' from dual
    'B'
    b
    2/try
    exit (requires recent version of sql developer: tools->preferences->Database->worksheet->Re-initialize on script exit command)
    select '&&fred' from dual;
    exit
    run this multiple times
    [prompts here]
    old:select '&&fred' from dual
    new:select 'x' from dual
    'X'
    x
    Commit
    [prompts here]
    old:select '&&fred' from dual
    new:select 'y' from dual
    'Y'
    y
    Commit
    3/use &fred instead of &&fred
    For background see
    http://totierne.blogspot.co.uk/2010/04/substitution-and-bind-variables.html
    -Turloch
    SQLDeveloper team

  • Prompting for user input in nested select statements

    I recently rewrote a query to use a nested select statement instead of specifying every SELECT field on the GROUP BY line.  Here's the query which works perfectly with hard-coded values of '030', '01/01/11', and '12/31/11'.
    SELECT T0.[CardName] AS Customer, T0.[CardCode] as 'Cust ID', T0.[Phone1] as Phone, T0.[CntctPrsn] as 'Contact Person', T0.[Address], T0.[City], T0.[State1] as State, T0.[ZipCode] as 'Zip Code', T0.[Country],  T1.[TotalSales]
    FROM OCRD T0 
    INNER JOIN
       (SELECT I.[CardCode] AS CardCode, SUM(I.[DocTotal]) AS TotalSales
        FROM OINV I
        WHERE left (I.[CardCode], 3) = '030' AND (I.[DocDate] >= '01/01/11' AND I.[DocDate] <= '12/31/11')
        GROUP BY I.[CardCode]) T1
    ON T0.[CardCode] = T1.[CardCode]
    ORDER BY T0.[CardName]
    When I try to prompt for the left 3 characters of the CardCode (or the dates), ie.
        WHERE left (I.[CardCode], 3) = [%0] AND (I.[DocDate] >= '01/01/11' AND I.[DocDate] <= '12/31/11')
    I get an error "Column 'OCRD.CardName' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause".
    It's like putting a user variable in the inner SELECT made it part of the outer SELECT which is exactly what I was trying to avoid by re-writing this query with the inner SELECT.
    Can anyone explain what SQL Server is doing here and how to fix it?

    Thanks Gordon.  That's how I originally wrote the query and it works fine.  But I was disturbed that I had to GROUP BY every field in my SELECT statement when I really only wanted to group by CardCode.  So I did some research and came up with this where the inner select still groups by only CardCode and still takes user input.  I don't really understand why you need the commented SELECT statements in the SET lines, but you do.  Something about using real table fields for variables.
    DECLARE @startDate datetime
    DECLARE @endDate datetime
    DECLARE @rep varchar(10)
    SET @rep /* SELECT T0.[CardCode] FROM ORDR T0 WHERE T0.[CardCode] */ = '[%0]'
    SET @startDate /* SELECT T0.[DocDate] FROM OINV T0 WHERE T0.[DocDate] */ = '[%1]'
    SET @endDate /* SELECT T0.[DocDate] FROM OINV T0 WHERE T0.[DocDate] */ = '[%2]'
    SELECT T0.[CardName] AS Customer, T0.[CardCode] as 'Cust ID', T0.[Phone1] as Phone, T0.[CntctPrsn] as 'Contact Person', T0.[Address], T0.[City], T0.[State1] as State, T0.[ZipCode] as 'Zip Code', T0.[Country],  T1.[TotalSales]
    FROM OCRD T0 
    INNER JOIN
       (SELECT I.[CardCode] AS CardCode, SUM(I.[DocTotal]) AS TotalSales
        FROM OINV I
        WHERE left (I.[CardCode], 3) = @rep AND (I.[DocDate] >= @startDate AND I.[DocDate] <= @endDate)
        GROUP BY I.[CardCode]) T1
    ON T0.[CardCode] = T1.[CardCode]
    ORDER BY T0.[CardName]
    FOR BROWSE

  • Increasing max # of inputs on prompt for user input

    Hi
    I would like to increase the number of inputs beyond 10 available on the prompt user for input function. At the moment I am using 9 of the 10 available inputs each running a subVI from a case structure. I seem to be limited to 10 inputs using the prompt user for input function so is there another way of prompting the user to select from >10  inputs preferably 20. 
    Thanks for any help
    Chris
    Solved!
    Go to Solution.
    Attachments:
    WASP dialog.vi ‏57 KB

    You can always write you own dialog with as many selections as you like.
    Right-click the express VI and "open front panel" This will convert it to a VI that you can edit in any way you want. save it under a new name.
    You might even want to add some validation code, e.g. to make sure that no more than 2 boxes are checked.
    LabVIEW Champion . Do more with less code and in less time .

  • Prompt for bind variables in SQL developer

    Hi!
    Just installed the latest 3.2 version of SQL Developer, and tried to do an explain plan.
    Now the tool prompts me for values for the bind variable. It didn't do that in my previous version (version 3. something).
    Thats anoying :-)
    How do I disable that feature?
    Example:
    explain plan for
    select * from emp
    where department_id = :1;
    If i right click on the statement or press F10, I get no prompt for the bind variable...
    Regards
    Søren

    Old fashioned way, like this:
    EXPLAIN PLAN FOR
    SELECT * FROM scott.emp
    where deptno = :1;
    SELECT PLAN_TABLE_OUTPUT FROM TABLE(DBMS_XPLAN.DISPLAY());
    Executed with F5 gives me this output
    plan FOR succeeded.
    PLAN_TABLE_OUTPUT
    Plan hash value: 3956160932
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 5 | 190 | 3 (0)| 00:00:01 |
    |* 1 | TABLE ACCESS FULL| EMP | 5 | 190 | 3 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    1 - filter("DEPTNO"=TO_NUMBER(:1))
    13 rows selected

  • Turn off Prompt for changes internal in SQL Developer

    We have created an SMS package to deploy SQL Developer in our organization.
    We would like to turn off the "check for updates switch".
    Is this a registry setting or in one of the files

    Thanks for the insight.
    I have been checking out the tool.
    We are going to use it to replace TOAD in 2008.
    Hopefully, it will stay "Free"!

  • Prompt for user inputs

    Hi,
    1) Want to prompt user for username & password
    2) connect to oracle
    3) want to use substring function on username entered by user
    3) user of substring output in procedure
    Performed as shown below but not working,
    PROMPT Enter username and password.
    PROMPT
    user:=&username;
    pass:=&passowrd;
    tns:=&tnsname;
    conn user/pass@tns
    PROMPT
    PROMPT
    set serveroutput on
    DECLARE
    variable1;
    variable2;
    varibale3;
    var:=substring(user,1,4);
    BEGIN
    var.package_name.procedure_name(cur);
    FETCH cur INTO variable1,variable2,varibale3;
    dbms_output.put_line('XYZ');
    END;
    Edited by: user640001 on Feb 28, 2012 11:27 PM

    trying to run as below but getting error for 'var'
    DECLARE
    var varchar2(20):=substr('&un',1,4);
    variable1 varchar2(20);
    cur var.package_name.Cursor;
    BEGIN
    var.package_name.procedure_name(cur);
    FETCH cur INTO variable1;
    dbms_output.put_line(variable1);
    END;
    cur var.package_name.Cursor;
    ERROR at line 16:
    ORA-06550: line 16, column 7:
    PLS-00487: Invalid reference to variable 'VAR'
    ORA-06550: line 16, column 7:

  • Differences between TOAD for Oracle and Oracle SQL Developer?

    Does someone know the advantages and disadvantages of using TOAD for Oracle and Oracle SQL Developer?
    I work making reports with TOAD, but in a few days I will have to use the SQL Developer (because it´s free) unless I justify the necessity of using TOAD.
    Could some that used both compare them?
    Thanks,
    Facundo.

    Hello Facundo,
    since we are rolling out new client PCs we switch from Toad to SQL Developer. Therefore I'm doing some training for the "normal" users and our developers.
    Most users simply want to have access to the data in tables and views. For those there are 2 main issues:
    - Filters get lost when exiting table while sorting is still applied. Since there is no way to apply filtering before entering the data tab this can become a great performance issue because sorting is applied to many many rows. For views it is sometimes impossible to open the data tab.
    - Exporting date values to Excel needs some know how if you want to sort by this column in Excel, because the date is formatted as "Standard" meaning that the sorting is done as for a text column: 01.01.2009 is less than 02.01.2008. Here you have to use a workaround column with a formula (=1*<datecolumn>)
    The greatest Pro is the easy sharing of connections and reports by XML files.
    Our developers like the easy debugging in SQL Developer. Though they miss the feature that the source is compiled for debug automatically as in Toad. For this we have distributed a script that compiles any PL/SQL object for debugging.
    There are only some Toads installed for DBAs and for users that need access to tables protected by policies that require authentification by OS user since this information is not passed under every circumstance.
    Regards
    Marcus

  • Using Proxy User Authentication in Sql Developer

    Hi!
    Is it possible to use proxy user authentication in SQL Developer? I'm thinking that if I'm clever enough, I can craft a custom jdbc URL that will allow my users to proxy authenticate into my Oracle 10gR2 database while using SQL Developer.
    Unfortunately, I'm not feeling all that clever. ;)
    Can anybody help me out here? Is it even in the realm of possibility?
    Thanks!
    Kevin Ferlazzo
    DBA
    VA Department of Juvenile Justice

    I found the possibility that proxy authentication of both accounts can be enforced:
    SQL> alter user appuser grant connect through personaluser AUTHENTICATION REQUIRED;
    I guess that this is the motivation for implementing the 2-session proxy connection method in SQL Developer.
    Regards,
    Martin

  • User input in SQL /PL-SQL

    Can I take the user input in SQL or PL/SQL please tell the procedure how can I do that suppose I am interested to get the information of the employee by respect to his age where age will be the user input (any person who will run the query prompted that enter the age)

    in PL/SQL you cannot make any terminal input because PL/SQL is running only on server side and has not been designed to handle such kind of input.
    With SQL*Plus, you can use PROMPT, ACCEPT instructions: see
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14357/ch5.htm#sthref1089

  • CR prompts for user credentials after refresh even though I'm using SSO

    Hello Experts,
    We have a problem with a customeru2019s project concerning Crystal Reportu2019s Single Sign On feature:
    Even though weu2019re using SSO, Crystal Reports prompts for user credentials every time a refresh is performed manually in the browser.
    We already checked SAP note [1214594 - How to avoid database login prompts when refreshing reports in Crystal Reports|http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_bi/sap%28bd1lbizjptawmq==%29/bc/bsp/spn/scn_bosap/notes%7B6163636573733d36393736354636443646363436353344333933393338323636393736354637333631373036453646373436353733354636453735364436323635373233443330333033303331333233313334333533393334%7D.do]. The note suggests using Microsoft Windows authentication (trusted connection or operating system authentication) u2013 unfortunately we cannot use this kind of authentication in our project.
    Do you have any hint, idea or suggestions?
    Thank you in advance!

    Hello,
    What kind of Project are you developing? Search for Post Back in the SDK forum and Kbase system so you can keep the log on token active. Likely what is happening is the Token or connection times out after 20 minutes, which is IIS's default timeout. Using the postback method is one way of keeping the SSO connection active.
    Thank you
    Don

  • Need help with Java app for user input 5 numbers, remove dups, etc.

    I'm new to Java (only a few weeks under my belt) and struggling with an application. The project is to write an app that inputs 5 numbers between 10 and 100, not allowing duplicates, and displaying each correct number entered, using the smallest possible array to solve the problem. Output example:
    Please enter a number: 45
    Number stored.
    45
    Please enter a number: 54
    Number stored.
    45 54
    Please enter a number: 33
    Number stored.
    45 54 33
    etc.
    I've been working on this project for days, re-read the book chapter multiple times (unfortunately, the book doesn't have this type of problem as an example to steer you in the relatively general direction) and am proud that I've gotten this far. My problems are 1) I can only get one item number to input rather than a running list of the 5 values, 2) I can't figure out how to check for duplicate numbers. Any help is appreciated.
    My code is as follows:
    import java.util.Scanner; // program uses class Scanner
    public class Array
         public static void main( String args[] )
          // create Scanner to obtain input from command window
              Scanner input = new Scanner( System.in);
          // declare variables
             int array[] = new int[ 5 ]; // declare array named array
             int inputNumbers = 0; // numbers entered
          while( inputNumbers < array.length )
              // prompt for user to input a number
                System.out.print( "Please enter a number: " );
                      int numberInput = input.nextInt();
              // validate the input
                 if (numberInput >=10 && numberInput <=100)
                       System.out.println("Number stored.");
                     else
                       System.out.println("Invalid number.  Please enter a number within range.");
              // checks to see if this number already exists
                    boolean number = false;
              // display array values
              for ( int counter = 0; counter < array.length; counter++ )
                 array[ counter ] = numberInput;
              // display array values
                 System.out.printf( "%d\n", array[ inputNumbers ] );
                   // increment number of entered numbers
                inputNumbers++;
    } // end close Array

    Yikes, there is a much better way to go about this that is probably within what you have already learned, but since you are a student and this is how you started, let's just concentrate on fixing what you got.
    First, as already noted by another poster, your formatting is really bad. Formatting is really important because it makes the code much more readable for you and anyone who comes along to help you or use your code. And I second that posters comment that brackets should always be used, especially for beginner programmers. Unfortunately beginner programmers often get stuck thinking that less lines of code equals better program, this is not true; even though better programmers often use far less lines of code.
                             // validate the input
       if (numberInput >=10 && numberInput <=100)
              System.out.println("Number stored.");
      else
                   System.out.println("Invalid number.  Please enter a number within range."); Note the above as you have it.
                         // validate the input
                         if (numberInput >=10 && numberInput <=100)
                              System.out.println("Number stored.");
                         else
                              System.out.println("Invalid number.  Please enter a number within range."); Note how much more readable just correct indentation makes.
                         // validate the input
                         if (numberInput >=10 && numberInput <=100) {
                              System.out.println("Number stored.");
                         else {
                              System.out.println("Invalid number.  Please enter a number within range.");
                         } Note how it should be coded for a beginner coder.
    Now that it is readable, exam your code and think about what you are doing here. Do you really want to print "Number Stored" before you checked to ensure it is not a dupe? That could lead to some really confused and frustrated users, and since the main user of your program will be your teacher, that could be unhealthy for your GPA.
    Since I am not here to do your homework for you, I will just give you some advice, you only need one if statement to do this correctly, you must drop the else and fix the if. I tell you this, because as a former educator i know the first thing running through beginners minds in this situation is to just make the if statement empty, but this is a big no no and even if you do trick it into working your teacher will not be fooled nor impressed and again your GPA will suffer.
    As for the rest, you do need a for loop inside your while loop, but not where or how you have it. Inside the while loop the for loop should be used for checking for dupes, not for overwriting every entry in the array as you currently have it set up to do. And certainly not for printing every element of the array each time a new element is added as your comments lead me to suspect you were trying to do, that would get real annoying really fast again resulting in abuse of your GPA. Printing the array should be in its own for loop after the while loop, or even better in its own method.
    As for how to check for dupes, well, you obviously at least somewhat understand loops and if statements, thus you have all the tools needed, so where is the problem?
    JSG

Maybe you are looking for

  • Hi, I have big problems since 2 weeks with outline, fonts, size in Ai CS6 : Numerical value are so big

    Hi, I have big problems since 2 weeks with outline, fonts, size in Ai CS6 : Numerical value are so big and I can't change it with smaller. Apparently Ai said me that comes from AiPrefs... Could you help me please. I tried to initialize my preferences

  • Vector Art Question

    I have two vector art images that need to be composited in a simple After Effects comp. One is a backround plate and the other is a vector of a person. The person slide in and the backround will go out of focus with text on top. I did a mock up and t

  • Transferring content from Time capsule

    I backed up our computers on Time Capsule. Our Imac has crashed and I need to access the backup files from that computer ( on the Time Capsule ) How can I do it. I tried Migrating assistant but it didn't transfer my photo library. How can I access th

  • Opening Files in Pages, Preview, Numbers, etc.

    How do prevent these apps from opening up several documents at once?  I double click on a file to open it and suddenly my desktop is full of windows of files that I've used previously . . . I would like to only open files I intend to open.

  • Images dragged out of trash have low resolution

    Some Aperture images ended up in system, not Aperture, trash. Found them there and dragged them out only to find they have very low resolution now. Can't find a way to restore their original resolution. The "Masters" seem to have the same low resolut