Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: PLEASE HELP with declaring variables in oracle DB
In article <aejh6r$qvt$1_at_news1.kornet.net>,
"Jonathan Park" <jpark_at_lims.co.kr> wrote:
> hello all,
>
> i am having trouble declaring data in oracle DB.
> i used
>
> define my-variable-name = 'hello oracle';
>
> but it seems to be bound to the session. ( data disappears when i log out
> and log in again ).
>
> how can i declare a variable to the DB table space permanantly?
> does any one know?
It's unclear as to what you are trying to do.
If you want to declare a variable for use during script execution, then you have the correct basic approach. Your example could thus be
variable my_variable_name varchar2(30)
or
define my_variable_name="hello oracle"
However, as you have observed, the variable (thus the name "variable")'s scope is only for the duration of the session.
If, on the other hand, you want to store data permanently in the database, you will need to first define and create the necessary objects (tables, indexes, views, triggers, etc.) and then INSERT the data, either programmatically or through the use of sqlldr.
Hth
-- The underscore character does not belong in my address. You know the drill... *** Anyone sufficiently smart enough to configure and use USEnet for research should be smart enough to Read The Freakin' Documentation!Received on Sun Jun 16 2002 - 22:09:38 CDT