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

Similar Messages

  • I am trying to buy songs on itunes and half way through the terms and conditions come up, I accept them and press return and then I get a 'session timed out' notice and the sale hasn't gone through - tried loads of times / updating software, any answers?

    I am trying to buy songs on itunes and half way through the terms and conditions come up, I accept them and press return and then I get a 'session timed out' notice and the sale hasn't gone through - tried loads of times / updating software, any answers?

    I am trying to buy songs on itunes and half way through the terms and conditions come up, I accept them and press return and then I get a 'session timed out' notice and the sale hasn't gone through - tried loads of times / updating software, any answers?

  • 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

  • After Quicktime dowloads, it freezes half way through.

    I made a QT movie (size 640x480, H 264, K frame 24, frame reorder: yes, D rate: 2.30 mbits, sound: IMA 4:1 mono, about 76MB).  It runs fine on my MacBook. I uploaded it to my website, it was then sent through an email and downloaded to another MacBook Air.  it looks clear and the sound is fine til half way through, then the screen freezes and the music stops, the little dot though still moves along the bottom of the control bar, as if it is still going. Tried downloading again and teh same thing happens in the same place. This happened with another video as well.
    Any ideas?

    Welcome to Apple Discussions BigMak
    This is likely not a preference issue, but just to be sure, when you deleted the preferences, did you delete all of the preference files as I detail in my user tip, AppleWorks has stopped working correctly?
    More likely this "freezing" (as opposed to crashing) is a problem with full Recent Items and/or AutoSave folders or a corrupt font. There are three articles in the User Tips Library dealing with Recent Items.
    Dale Gillard - AppleWorks slow? Spinning ball appears?
    Dale Gillard - Recent items not visible/updated
    Yvan Koenig - No More Recent Items
    The most frequent cause of AppleWorks quitting during start up is a corrupt font. In watching the AppleWorks start up window, do you see where it was when it crashed? If my guess is correct, it would be during "Building Font Menu." First, look for a font named Bauhaus 93. This font is installed by versions of Microsoft Office before Office 2004. The Bauhaus 93 with Office 2004 is not corrupt. If you don't find Bauhaus 93 you'll need to go through the trial & error of locating a corrupt font. Using the OS X Font Book is not reliable when it comes to finding problem fonts affecting AppleWorks.
    The trial & error method of corrupt font isolation involves moving all of the fonts from the various font folders to another folder (the Desktop is a good place) & then moving a few back at a time & trying to launch AppleWorks. When it crashes you will know the culprit is in the last bunch.
    Peggy

  • HT201263 my iphone 3g is coming up with an error message once it gets half way through the restore it says error phone cant be restored anybody know how i fix this

    i have been trying to update my iphone and when i tried to do so it said i needee to restore it first so tried this and since my phone just has the usb icon and itunes showing on it wont turn on or anything and half way through restore it comes up with an error message saying it cant complete it anybody know how i fix this please doin  my head in

    We aren't Apple, just users like you volunteering to help other users with problems. Threatening to go to Samsung doesn't mean anything to us. What troubleshooting have you tried so far?

  • How do I cancel a printing job half way through?

    How do I cancel a printing job half way through?  hp psc 1310 series
    This question was solved.
    View Solution.

    Press the "Cancel" button on the printer.  It is the button on the upper left, just below the power button.  See page 2 of the manual here.
    Bob Headrick,  HP Expert
    I am not an employee of HP, I am a volunteer posting here on my own time.
    If your problem is solved please click the "Accept as Solution" button ------------V
    If my answer was helpful please click the "Thumbs Up" to say "Thank You"--V

  • 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

  • 8900 Keeps Rebooting half way through a Reboot.

    Hi,
    I use my BlackBerry for Business, it's my primary phone for both work and personal. Recently I got a brand new 8900 and worked great. One night while away on business it froze for the first time, I pulled out the battery and rebooted it and it kept rebooting half way through. I could not connect it to a PC at all.
    T-Mobile offered no help and sent me to a third party repair guy who told me it would fix it for 60 dollars. This is frustrating as this phone for one is expensive and brand new and should not fail, and secondly, t-mobile offers no support.
    Now for the kicker, my roomate has the same phone and went and got the Droid. He leant me his 8900, also brand new sub 6 months where my first one is sub 3 months old.
    Well tonight, I installed the new bbm and it rebooted the phone and guess what....same thing. Now I have no phone and of course, no support from my carrier. What in gods name is going on with these phones?

    If there is no error message on the phone display that indicates what is going on ("AppError", "JVM Error", both with codes), then we must guess. You might have some luck with this article:
    http://crackberry.com/blackberry-101-lecture-12-how-reload-operating-system-nuked-blackberry
    As for support, front line support for BB's is, by contract, not provided by RIM. The carriers and authorized resellers are responsible for front line formal support to end users. It is possible to bypass your carrier and seek assistance direct from RIM, but such involves fees since you are bypassing your support agreement with your carrier. The "Support and Services" tab toward the top of these forum pages provide information about that. But, if you do go through your carrier for support, they can escalate into RIM at no fee to you if they so choose to.
    Good luck and let us know!
    Occam's Razor nearly always applies when troubleshooting technology issues!
    If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post. Please click here and read, along with the threads to which it links, for helpful information to guide you as you proceed. I always recommend that you treat your BlackBerry like any other computing device, including using a regular backup schedule...click here for an article with instructions.
    Join our BBM Channels
    BSCF General Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • A movie i purchased does not show up in  the download after it suddenly stopped while downloading over half way through

    a movie i purchased does not show up in  the download after it suddenly stopped while downloading over half way through.. help!

    I totally agree, I am not going to discredit your comment as everyone is entitled to their opinion as I am BUT, I will not bad mouth other members, especially since  may have not have written my initial statement in a logical manner so Ill try and answer them in order to your response.
    1. I DO LIKE iTunes in general and on the whole  BUT I dislike the new update, iTunes 11, it has completely buggered everything up.
    2. Prior to the update, everything worked brilliantly, including Apple TV. It was user friendly and was easy to use. The new update is counter-intuative and is hard to find, fix anything and as I have had to find out at my cost, reset my Apple TV and start downloading all over again. So let me reaffirm, it is iTunes11 I find hard to fathom, not the old iTunes.
    3. No I am not a developer but I have been using PC's for over 20 years so I do know how one works.
    4. Good Question about who would help me, again, it is someones opinion against someone elses. One day, I may write something that generally people agree with, another they may not, depends on the subject.
    5. " I do not love Apple" ?yet I have an iPhone 4s, iPad and Apple TV, find that an illogical comment!
    6. I have made a General Search on the forums on the subject and the general consensus is that the new update is one update to far.
    7. Oh, I am not a genius otherwise I would have solved the issue in the first place!
    Just to re-iterate, I am not bad mouthing Apple in general, all I am saying is that iTunes 11 is one update to far and I am not the only one saying it.... some have gone a lot further than I have, again, their opinion and who am I to argue with them as I have an opnion as you do and I will most deffinatly not bad mouth a member because I disagree with them for the above reason, debate it, yes, not belittle them.
    Hope these have cleared up my initial statement?

  • I hired a movie and half way through it stopped loading so i exited the movie and it vanished, when i clicked on the movie again it asked if i wanted to rent it???

    i rented a movie from the apple store off my apple TV half way through the movie it stopped like it was waiting for it start loading. i then exited the movie and went to click on it again but found that the movie was no longer there and when i clicked on the same movie it asked it i wanted to rent it, which i had just done. i would just like to know what happened here and how to fix this?

    This has happened to me 3 consecutive times!!
    3 movies. 3 mysterious stopages in mid movie with no fix.
    If only they solved their own problems as quickly as the scoffed your money!
    I have no idea how to report it.
    Apple only wants to communicate with you when you want to purchase products but makes it brutaly painfull to solve problems.
    They have become a pathetic, gready symbol of sloppy excess.
    They WIIL fail because they forgot how deliver their products.
    I was a lifelong apple user and that is over for good!
    I've been ripped off by them for the last time!
    There's too much competant competition out there now.

  • Creative Cloud opening stops half way through with message: administrative privilege required.

    creative cloud opening stops half way through with message: administrative privilege required.

    It means what it says - you have to run as admin or a similar user with sufficient user privileges.
    Mylenium

  • My ipod stops half way through step 1 when I am syncing

    I[od touch stops half way through step q which i backing up

    I would try moving the existing backup to a safe place since there may be some corruption that is causing the problem.  The backup file is located hre:
    The folder where your backup data is stored changes depending on the computer's operating system. Since iTunes only keeps one backup per device, you should ensure the backup folder is included in your periodic data backup routine.
    iTunes places the backup files in the following places:
    Mac: ~/Library/Application Support/MobileSync/Backup/
    Windows XP: \Documents and Settings\(username)\Application Data\Apple Computer\MobileSync\Backup\
    Windows Vista and Windows 7: \Users\(username)\AppData\Roaming\Apple Computer\MobileSync\Backup\
    Note: If you do not see the AppData or Application Data folders, you may need to show hidden files (Windows XP,  Windows Vista and Windows 7).

  • Help - PC Rebooted half way through an N80 FW Upgr...

    Hopefully someone will be able to help!
    I was updating the Firmware in a brand new N80 and the PC decided to reboot half way through the process. Now the phone will not even power on.
    rgds
    Jim

    09-Jul-200711:28 PM
    planetf1 wrote:
    So question. Isn't it about time at least the basic loader was doubled up, and/or refreshed from phone ram rather than this potentially unreliable process which seems to -- not infrequently -- result in bricking.
    Good idea - but remember one thing - if you read the title of this post "Re: Help - PC Rebooted half way through an N80 FW Upgrade" it states that the PC rebooted - and Nokia has no control over this element of the proceedings unfortunately.
    You could make a point that Nokia should have make the NSU more capable of recovering a phone in case of a previous failure, and this could indeed come in future incarnations of the application, but the PC will always be an element of the proceedings which are a "wildcard" in the sequence of events.
    I'm pretty certain for every user who has reported a problem upgrading their firmware, there's probably about 6 or 7 (if not more) that have upgraded without problems - the trouble is that you don't hear about it because they haven't experienced any issues !
    I myself have upgraded my firmware on the N70 and N95 two or three times without any problems.
    Regards,
    Edward

  • HELP - iPhone starts back up but crashes half way through

    I cant back up my iphone. After changing to a windows 7 PC, my iphone will not back up. It attempts it but seems to crash half way through, I have tried doing it without pics, still no joy. I cant update to the latest iphone software as it always backs up first, which it wont do. Have reinstalled itunes, tried a different USB port, left it over nigh, no joy. Seems to be a common problem, but hard to find a solution. Any solutions out there?

    Try create a fresh user account on your computer and do the back-up by following this link (http://support.apple.com/kb/HT4137) that will help isolate the problem if it's actually corrupted files in your computer causing this crash!!

  • Please Help. Photoshop installation failed half way through

    Initially I had downloaded the photoshop CC2014 trial once, I paid I wanted the CC version because I need the oil paint function which was taken out on the CC2014 version, so what I did is uninstall the CC2014 which was installed and working and proceeded to install the CC version but midway through installation it kept failing and telling me to restart my computer, I have done that at least half a dozen times, plus I've also tried the following:
    > I uninstalled every adobe app I had including CC
    > I have used the Adobe Creative Cloud Cleaner tool app
    > Have restarted my computer so many times I lost count and I still get the same error, half way through the installation process
    > And now the same thing is happening when I try to reinstall illustrator, this is a nightmare!
    BTW I'm not running any other software while doing this and have turned off the fire walls
    I'm on an Imac OS X version 10.9.5
    Please help I've spent so manny hours trying to solve this, it's driving me crazy and need to complete some work in photoshop I have deadline.
    Latest log report: 10/11/14 19:54:40:043 | [ERROR] |  | OOBE | DE |  |  |  | 128135 | ASU has quit unexpectedly.
    they all say the same

    Tat7 I would recommend reviewing your installation log files for actionable error messages.  You can find details on how to locate and interpret your installation logs at Troubleshoot install issues with log files | CC - http://helpx.adobe.com/creative-cloud/kb/troubleshoot-install-logs-cc.html.  You are welcome to post any additional errors you locate to this discussion.

Maybe you are looking for