Home » SQL & PL/SQL » SQL & PL/SQL » SQL Variables?
SQL Variables? [message #20608] Thu, 06 June 2002 13:00 Go to next message
StrangeLuck
Messages: 2
Registered: June 2002
Junior Member
I was wondering if someone could tell me how I could save the result of a query as a variable? For example, if I have a query:

"SELECT emp_name FROM employees WHERE emp_id = '" & employeenumber & "'"

How can I save the result of that query to a variable in VBscript that I can then pass along to another INSERT string later on?

Thanks,
Corey
Re: SQL Variables? [message #20610 is a reply to message #20608] Thu, 06 June 2002 14:15 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
declare
var1 number;
begin
select empno into var1 from emp where ename='&ename';
end;

The result is stored in <i>var1</i> 
Re: SQL Variables? [message #20614 is a reply to message #20608] Fri, 07 June 2002 04:19 Go to previous messageGo to next message
Balaji
Messages: 102
Registered: October 2000
Senior Member
write a function which takes empno as the argument with return datatype as string variable . typically the return variable should give the employee name.
Re: SQL Variables? [message #20616 is a reply to message #20608] Fri, 07 June 2002 05:07 Go to previous message
StrangeLuck
Messages: 2
Registered: June 2002
Junior Member
But, how can I use this in Javascript? I am trying to make an ASP page which will take numeric variables from the submit page, match them with their text counterparts in an Access database via SQL and then insert the text counterparts along with two dates into a table in the same database.

So far, the ASP page works and submits the values to a new page for processing, but I cannot match the variables with the text counterparts and then submit them and two date variables to the table in the database.

Any help would be appreciated!

Thanks,
StrangeLuck
Previous Topic: Re: Can we use PL/SQL key words as Coloumn Names
Next Topic: Getting record set back from stored proc
Goto Forum:
  


Current Time: Thu Apr 25 14:19:07 CDT 2024