Re: Selecting from dynamic performance views in PL/SQL



Andreas Sheriff schrieb:
Database Version: 8.1.5.0.0

Granted SELECT_CATALOG_ROLE to user.
07_DICTIONARY_ACCESSIBLITY is default

SQL> select * from v$instance;

Works.

SQL> DECLARE
2 v_startup_time DATE;
3 BEGIN
4 /* First, see if the database was restarted and store the new startup value
5 if it were */
6 select startup_time into v_startup_time from v$instance;
7 END;
8 /


PL/SQL procedure successfully completed.

Works.

SQL> create or replace procedure os_collectstats
2 AS
3 v_startup_time DATE;
4 BEGIN
5 /* First, see if the database was restarted and store the new startup value
6 if it were */
7 select startup_time into v_startup_time from v$instance;
8 END;
9 /


Warning: Procedure created with compilation errors.

SQL> show errors
Errors for PROCEDURE OS_COLLECTSTATS:

LINE/COL ERROR
-------- -----------------------------------------------------------------
7/5      PL/SQL: SQL Statement ignored
7/50     PLS-00201: identifier 'SYS.V_$INSTANCE' must be declared

Yields said errors.

I've tried putting v$instance in quotes ("V$INSTANCE"), but got the same error.

Anyone know why this CREATE PROCEDURE didn't work?
Did I forget something?

I don't have access to metalink, but am actively searching the web for an answer. Nothing so far.


Requirement (for objects accessed) to be granted not via role applies only to *named* plsql blocks ( also procedures,packages,functions).
For anonymous block role is sufficient.


Best regards

Maxim
.



Relevant Pages

  • Re: Problems with querying date field
    ... >> If you want to put a database somewhere for safekeeping, ... database - SQL isn't about persistence, ... says nothing about the physical storage media to be used. ... store data on a tape, or a disk, or a CD, or a file, or any physical ...
    (microsoft.public.sqlserver.programming)
  • Re: Storing docs in database vs storing in file system
    ... > the file system and simply keeping a pointer to each file in the database. ... I personally found the storage in sql method ... the files when they were stored in the directory structure. ... directory structure to store all the files. ...
    (microsoft.public.sqlserver.programming)
  • Re: How do you store .JPG in ACCESS using VB.NET
    ... I thought if I could find a solution hear in VBA land I could convert to .NET ... > You've mistakenly posted your question in the Microsoft Access (the database ... Jet SQL or any SQL dialect of the database server the front end is ... >>I have written a program to store images. ...
    (microsoft.public.access.modulesdaovba)
  • Re: Sharepoint Installation MSDE Location Question
    ... I want to host the SQL Server and WSS on the ... and I want to store the SQL database on a storage array ...
    (microsoft.public.sharepoint.windowsservices)
  • Re: Involved query / possible over Access assistance.
    ... Also, Standard SQL doesn't include a bit operator, but most SQL products ... read some database design books or articles on the WEB for info on ... However, I want to store ... > I want to then do a query for a given week. ...
    (microsoft.public.access.queries)