Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: v$database

Re: v$database

From: Jusung Yang <jusungyang_at_yahoo.com>
Date: 7 Aug 2002 20:41:02 -0700
Message-ID: <42ffa8fa.0208071941.374c2214@posting.google.com>


Probably the same old problem again. Look up the discussions from around 7/30 under the subject title "using sys.all_tables in a cursor".

jhking <jhking_at_airmail.net> wrote in message news:<C3520C9D875DA5C7.032057F1C822E449.5DEF9D353EBD44C4_at_lp.airnews.net>...
> I need to know which instance I'm running in:
> from sql*plus
> select name from v$database ;
> NAME
> ---------
> HTD1
>
> -- good, just want I want, put it in a function so I don't have the
> select all over the place.
>
> SQL> create or replace function whereami
> 2 return varchar2
> 3 is
> 4 inst v$database.name%type ;
> 5 begin
> 6 select name
> 7 into inst
> 8 from v$database ;
> 9 return inst ;
> 10 end ;
> 11 /
>
> Warning: Function created with compilation errors.
>
> SQL> show errors
> Errors for FUNCTION WHEREAMI:
>
> LINE/COL ERROR
> -------- -----------------------------------------------------------------
> 4/9 PLS-00201: identifier 'SYS.V_$DATABASE' must be declared
> 4/9 PL/SQL: Item ignored
> 6/5 PL/SQL: SQL Statement ignored
> 8/12 PLS-00201: identifier 'SYS.V_$DATABASE' must be declared
> 9/5 PL/SQL: Statement ignored
> 9/12 PLS-00320: the declaration of the type of this expression is
> incomplete or malformed
>
> How can I get this information from inside a function/procedure/package?
>
>
> 8.1.7.0.0 database on Solaris.
Received on Wed Aug 07 2002 - 22:41:02 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US