Geeks Talk

Prepare for your Next Interview


Welcome to the Geeks Talk forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

taking inputs at run time

This is a discussion on taking inputs at run time within the SQL forums, part of the Databases category; hi... i want to write a procedure which can take inputs from user at runtime (not at compile time). "&" didnt work. please tell me syntax for the same......

Go Back   Geeks Talk > Databases > SQL
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read
  #1 (permalink)  
Old 06-30-2009
Junior Member
 
Join Date: Jun 2009
Location: Mumbai
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
satyajit101 is on a distinguished road
taking inputs at run time

hi...

i want to write a procedure which can take inputs from user at runtime (not at compile time). "&" didnt work.

please tell me syntax for the same...
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-01-2009
Contributing Member
 
Join Date: Jun 2009
Location: United States
Posts: 71
Thanks: 0
Thanked 5 Times in 4 Posts
CSOOR is on a distinguished road
Re: taking inputs at run time

Did you use ACCEPT command ?
Reply With Quote
  #3 (permalink)  
Old 07-03-2009
Junior Member
 
Join Date: Jun 2009
Location: Mumbai
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
satyajit101 is on a distinguished road
Re: taking inputs at run time

How to use accept command
Reply With Quote
  #4 (permalink)  
Old 07-03-2009
Expert Member
 
Join Date: May 2009
Location: Bangalore
Posts: 989
Thanks: 155
Thanked 420 Times in 201 Posts
rijus is just really nicerijus is just really nicerijus is just really nicerijus is just really nicerijus is just really nice
Re: taking inputs at run time

Satyajith,

The accept command can be used to prompt for a value for a substitution variable.

When no prompt is supplied it will display a message to enter a value for variable.

If the variable already exists the old value will be shown so the user can change it.

Syntax:
ACCEPT variable [PROMPT text ];

Eg:

Display a message to enter an employee number before getting the data for that employee:

ACCEPT myempno PROMPT 'Enter an employee number';
select * from emp where empno = &myempno;


OR

Display a message to enter a department number before getting the department data. The value for department should be preset to 20, the user can change it at the prompt:

DEFINE mydeptno = 20;
ACCEPT mydeptno PROMPT 'Enter the department number';
select * from dept where deptno = &mydeptno;


Thanks & Regards,
Riju.
Reply With Quote
  #5 (permalink)  
Old 08-11-2009
Junior Member
 
Join Date: Aug 2009
Location: Delhi
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
sunil.bisht12 is on a distinguished road
Re: taking inputs at run time

u can use the & like
select * from emp where deptno=&deptno;
Reply With Quote
  #6 (permalink)  
Old 2 Weeks Ago
Expert Member
 
Join Date: Apr 2007
Location: Bangalore
Posts: 517
Thanks: 30
Thanked 63 Times in 61 Posts
susarlasireesha will become famous soon enough
Re: taking inputs at run time

u can pass parameter before executing sql qry.
In procedure,we can not pass inputs in middle of the procedure process.
but at time of execution ,we can pass parameters to procedure (only when the procedure is Parameterized)
__________________
Sireesha
Reply With Quote
Reply

  Geeks Talk > Databases > SQL

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
How can I pass inputs to job through JCL Geek_Guest MainFrame 3 02-26-2008 06:37 AM
Get out put without taking argument aarruunnaa C# 1 12-29-2007 01:29 AM
How to automate user inputs... psuresh1982 Java 1 08-18-2007 05:38 AM
Regarding Inputs Namedm C# 2 06-11-2007 04:57 AM
Taking much time to open form in project instance.. JobHelper Oracle Apps 0 02-08-2007 02:43 PM


All times are GMT -4. The time now is 07:02 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2009 GeekInterview.com. All Rights Reserved