473,396 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

user interaction in pl/sql

hi!!
just wanna know how to accept user input??
if i prompt a question "Are u happy today?(Y/N)"
how do i receive user's answer?
thnx
Jul 19 '05 #1
7 19253

"DottingTheNet" <do***********@hotmail.com> wrote in message
news:11**************************@posting.google.c om...
hi!!
just wanna know how to accept user input??
if i prompt a question "Are u happy today?(Y/N)"
how do i receive user's answer?
thnx

You can do this in sqlPlus but not in pl/sql.
Jim
Jul 19 '05 #2

"Jim Kennedy" <ke****************************@attbi.net> wrote in message
news:LAndc.95053$gA5.1237341@attbi_s03...
|
| "DottingTheNet" <do***********@hotmail.com> wrote in message
| news:11**************************@posting.google.c om...
| > hi!!
| > just wanna know how to accept user input??
| > if i prompt a question "Are u happy today?(Y/N)"
| > how do i receive user's answer?
| > thnx
| You can do this in sqlPlus but not in pl/sql.
| Jim
|
|
pl/sql is run in the database (unless you're using oracle's Form or Report
Builder tools to developer GUI apps)

so, there is no communication with the client tool while PL/SQL is running,
hence no prompting

what is your development environment?

;-{ mcs
Jul 19 '05 #3
DottingTheNet wrote:
hi!!
just wanna know how to accept user input??
if i prompt a question "Are u happy today?(Y/N)"
how do i receive user's answer?
thnx


Counter-question - if the database is on a server, and the pl/sql is run in
the database, where is the answer coming from?

You might want to give some hint of the environment you are running. Are
you displaying in a browser or in SQL Plus?
Jul 19 '05 #4
Hans Forbrich <fo******@yahoo.net> wrote in message news:<pKndc.23709$J56.18035@edtnps89>...
DottingTheNet wrote:
hi!!
just wanna know how to accept user input??
if i prompt a question "Are u happy today?(Y/N)"
how do i receive user's answer?
thnx


Counter-question - if the database is on a server, and the pl/sql is run in
the database, where is the answer coming from?

You might want to give some hint of the environment you are running. Are
you displaying in a browser or in SQL Plus?


you can try with colon (:variablename) in pl-sql. This should prompt for a value.
Jul 19 '05 #5

"niranjan v sathe" <sa***********@yahoo.com> wrote in message
news:c3**************************@posting.google.c om...
| Hans Forbrich <fo******@yahoo.net> wrote in message
news:<pKndc.23709$J56.18035@edtnps89>...
| > DottingTheNet wrote:
| >
| > > hi!!
| > > just wanna know how to accept user input??
| > > if i prompt a question "Are u happy today?(Y/N)"
| > > how do i receive user's answer?
| > > thnx
| >
| > Counter-question - if the database is on a server, and the pl/sql is run
in
| > the database, where is the answer coming from?
| >
| > You might want to give some hint of the environment you are running.
Are
| > you displaying in a browser or in SQL Plus?
|
| you can try with colon (:variablename) in pl-sql. This should prompt for a
value.

not exactly... if you're submitting anonymous pl/sql blocks, some tools may
notice the bind variable and prompt for it, but SQL*Plus will not
automatically prompt for bind variable

SQL> begin
2 dbms_output.put_line('A bind variable... ' || : x );
3 end;
4 /
SP2-0552: Bind variable "X" not declared.
additionally, stored PL/SQL program units will not compile with bind
variables

SQL> create or replace procedure bindx
2 is
3 begin
4 dbms_output.put_line('A bind variable... ' || : x );
5 end;
6 /

Warning: Procedure created with compilation errors.

SQL> show errors
Errors for PROCEDURE BINDX:
....

LINE/COL ERROR
-------- -----------------------------------------------------------------
4/50 PLS-00103: Encountered the symbol ":" when expecting one of the
following:
( - + mod null <an identifier>
<a double-quoted delimited-identifier> <a bind variable> avg
count current max min prior sql stddev sum variance execute
forall time timestamp interval date
<a string literal with character set specification>
<a number> <a single-quoted SQL string>
The symbol ":" was ignored.

;-{ mcs
Jul 19 '05 #6
niranjan v sathe wrote:
Hans Forbrich <fo******@yahoo.net> wrote in message

you can try with colon (:variablename) in pl-sql. This should prompt for a
value.


Not unless you are in SQL*Plus (or iSQLPlus). And even then, you must set
it up right.
Jul 19 '05 #7
Hans Forbrich <fo******@yahoo.net> wrote in message news:<PXDdc.26544$J56.21293@edtnps89>...
niranjan v sathe wrote:
Hans Forbrich <fo******@yahoo.net> wrote in message

you can try with colon (:variablename) in pl-sql. This should prompt for a
value.


Not unless you are in SQL*Plus (or iSQLPlus). And even then, you must set
it up right.


Try an Ampersand "&" ... it's about the closest you can get to
prompting while in PL/SQL ... but as Jim pointed out, you can't do the
"prompt" in pl/sql ..

Here's the difference (both run on Unix O/S):

SQL*Plus:

accept happy prompt "Are You Happy Today? (Y/N) "

select something
from somewhere
where some_column = '&happy'
/

-- OR ... fall into pl/sql after gathering the prompts ...

declare
lv_happy varchar2(1) := upper(ltrim(substr(nvl('&happy', 'N'), 1,
1)));
begin
-- place code here
end;
/

----------------
But for PL/SQL ... you really only have this choice:

declare
lv_happy varchar2(1) := upper(ltrim(substr(nvl('&areyouhappy',
'N'), 1, 1)));
begin
-- place code here
end;
/

-----------
and that's about the best you can do ....

The Elementalist
Jul 19 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Dan | last post by:
Hello all, Is it possible to disable user interaction from keybord? Thanks
2
by: prakash.guru | last post by:
Hi Friends . I try to do a javascript program which automatically fire an event or redirects to a page when there is no user interaction between user & browser for 15 minutes. Is it possible in...
3
by: Aaron Queenan | last post by:
I have a form which performs some asynchronous code. I want to display a wait cursor when it starts, and hide the wait cursor when it has completed. This part works fairly well, using: ...
4
by: EvanK | last post by:
Is there a way to display a message box and have it close after a certain amount of time w/o user interaction?
3
by: sheldonlg | last post by:
I don't think my last attempt posted so here it is again. This is a bit off-topic, but it does relate to php. This is the most active related group that I can find, so even if it is off-topic I...
2
by: Thinker | last post by:
Hi I am currently creating a web bot that simulates a user interaction with a webpage. The Bot's functionality would be similar to what an end user does on a data entry webpage Any...
0
by: Glenn Palomar | last post by:
Hi, I'm trying to simulate user interaction over an application. Using API's such as FindWindowEx, GetWindow, SendMessage, ShowWindow, etc. I am able to do a bunch of stuff already. I am...
2
by: ext237 | last post by:
hello. I'm trying to halt a function's execution while waiting for user interaction. For example, I have a function called getUserValue() that pops up a hidden div containing several buttons....
1
by: dwij2u | last post by:
Hi All, Can someone guide me on how we can modify the below script so that no user interaction is required to feed the password when the script is run, current scenario is like if I try to login...
3
by: nelsonbrodyk | last post by:
Hey All, I can't see to find a nice solution to this. I have a textbox, and a button. When the textbox text is set by the user, I want the button to enable. When the text is set through code (ie....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.