473,382 Members | 1,407 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,382 software developers and data experts.

how to use select clause in assignment

joy
I am writting a procedure, i am using a table:
part(empno,...,partid,..). I already know the partid, and I need to
know empno so I can use it to invoke another procedure--like
empb(myid). part of the code like:
myid =
(select empno
from part
where partid = part_id;);
and I started the procedure, it gave me:
15/16 PLS-00103: Encountered the symbol "SELECT" when expecting one
of
the following:
( - + case mod new not null others <an identifier>
<a double-quoted delimited-identifier> <a bind variable> avg
count current exists max min prior sql stddev sum variance
execute forall merge time timestamp interval date
<a string literal with character set specification>
<a number> <a single-quoted SQL string> pipe

17/39 PLS-00103: Encountered the symbol ")"
what should I do? Thanks for help!
Jul 19 '05 #1
3 8471
look in the first chapter of the PL/SQL Users Guide under 'Assigning Values
to Variables''

you need to user the SELECT INTO syntax

-- mcs

"joy" <jo******@yahoo.com> wrote in message
news:35**************************@posting.google.c om...
| I am writting a procedure, i am using a table:
| part(empno,...,partid,..). I already know the partid, and I need to
| know empno so I can use it to invoke another procedure--like
| empb(myid). part of the code like:
| myid =
| (select empno
| from part
| where partid = part_id;);
| and I started the procedure, it gave me:
| 15/16 PLS-00103: Encountered the symbol "SELECT" when expecting one
| of
| the following:
| ( - + case mod new not null others <an identifier>
| <a double-quoted delimited-identifier> <a bind variable> avg
| count current exists max min prior sql stddev sum variance
| execute forall merge time timestamp interval date
| <a string literal with character set specification>
| <a number> <a single-quoted SQL string> pipe
|
| 17/39 PLS-00103: Encountered the symbol ")"
| what should I do? Thanks for help!
Jul 19 '05 #2
like this,

EXECUTE IMMEDIATE 'select empno from part where partid = '||part_id into myid;
Jul 19 '05 #3
Christine wrote:
like this,

EXECUTE IMMEDIATE 'select empno from part where partid = '||part_id into myid;


Use BIND variables:
EXECUTE IMMEDIATE 'select empno from part where partid = :a'
using part_id
into myid;
--
Regards, Frank van Bortel

Jul 19 '05 #4

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

Similar topics

5
by: malcolm | last post by:
Example, suppose you have these 2 tables (NOTE: My example is totally different, but I'm simply trying to setup the a simpler version, so excuse the bad design; not the point here) CarsSold {...
4
by: 001 | last post by:
Hello, The select statement needs only 1 second to complete the query. But the update statement spends 30 minutes. Why? SELECT STATEMENT: declare @IDate smalldatetime select @IDate=col001...
3
by: Tcs | last post by:
My backend is DB2 on our AS/400. While I do HAVE DB2 PE for my PC, I haven't loaded it yet. I'm still using MS Access. And no, I don't believe this is an Access question. (But who knows? I...
19
by: William Wisnieski | last post by:
Hello Everyone, I have a main form with a datasheet subform that I use to query by form. After the user selects two criteria on the main form and clicks the cmdShowResults button on the main...
26
by: GreatAlterEgo | last post by:
Hi, This is my query which is embedded in a COBOL program. EXEC SQL SELECT DATE, AGE, DURATION, AMT INTO :LDATE, :L.AGE, :L.DURATION, :L.AMT FROM TAB1 WHERE CODE = :KEY.CODE AND...
48
by: Jimmy | last post by:
thanks to everyone that helped, unfortunately the code samples people gave me don't work. here is what i have so far: <% Dim oConn, oRS, randNum Randomize() randNum = (CInt(1000 * Rnd) + 1) *...
22
by: MP | last post by:
vb6,ado,mdb,win2k i pass the sql string to the .Execute method on the open connection to Table_Name(const) db table fwiw (the connection opened via class wrapper:) msConnString = "Data Source="...
0
FishVal
by: FishVal | last post by:
Hereby I'm proposing a way of convinient work with properties containing SQL Select statements, particulary RowSource property of ComboBox and ListBox. The usual way is the following. Private...
3
by: joy | last post by:
I am writting a procedure, i am using a table: part(empno,...,partid,..). I already know the partid, and I need to know empno so I can use it to invoke another procedure--like empb(myid). part of...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.