Re: simple PL/SQL question

From: Tyler D. Muth <tyler_muth_at_hotmail.com>
Date: 4 Aug 2002 09:13:11 -0700
Message-ID: <1afec35e.0208040813.532f0146_at_posting.google.com>


vk02720_at_my-deja.com (vk02720) wrote in message news:<4d814faa.0207271452.5f9064da_at_posting.google.com>...
> While selecting into a variable like the following, how should the
> host variable be specified = :hostvariable or just hostvariable ?
>
> select name into v_name where empid = 100;
> OR
> select name into :v_name where empid = 100;
>
>
> I have seen the host variables referred to in both ways. What is the
> difference ?
> Does it matter if they are declared as VARIABLE or any other type ....
> ???
>
> TIA
Since any variable you declare in PL/SQL is a bind variable, stmt 1 will work fine. If you don't know what a bind variable is, search for it on asktom.oracle.com, it's the single most important thing you should know when writing performant applications in Oracle.

You might want to wrap that stmt in a begin <b>exception</b> end. If you don't have an exception and your query returns no rows, you'll get an error. Try it once to see what I mean. Good luck. Received on Sun Aug 04 2002 - 18:13:11 CEST

Original text of this message