.ora-code.com

Links
Home
Oracle DBA Forum
Frequent Oracle Errors
TNS:could not resolve the connect identifier specified
Backtrace message unwound by exceptions
invalid identifier
PL/SQL compilation error
internal error
missing expression
table or view does not exist
end-of-file on communication channel
TNS:listener unknown in connect descriptor
insufficient privileges
PL/SQL: numeric or value error string
TNS:protocol adapter error
ORACLE not available
target host or object does not exist
invalid number
unable to allocate string bytes of shared memory
resource busy and acquire with NOWAIT specified
error occurred at recursive SQL level string
ORACLE initialization or shutdown in progress
archiver error. Connect internal only, until freed
snapshot too old
unable to extend temp segment by string in tablespace
Credential retrieval failed
missing or invalid option
invalid username/password; logon denied
unable to create INITIAL extent for segment
out of process memory when trying to allocate string bytes
shared memory realm does not exist
cannot insert NULL
TNS:unable to connect to destination
remote database not found'>ora-02019
exception encountered: core dump
inconsistent datatypes
no data found
TNS:operation timed out
PL/SQL: could not find program
existing state of packages has been discarded
maximum number of processes exceeded
error signaled in parallel query server
ORACLE instance terminated. Disconnection forced
TNS:packet writer failure
see ORA-12699
missing right parenthesis
name is already used by an existing object
cannot identify/lock data file
invalid file operation
quoted string not properly terminated
Select from dual return 3 rows !

Select from dual return 3 rows !

2005-11-08       - By Magnus Andersen
Reply:     <<     11     12     13     14     15     16     17     18     19  

In the may issue of Oracle Magazine, Steven Feuerstein has an article of how
to write self managing PL/SQL. In the article he recommends to not use the
dual table but to actually create your own. You can find the article here:

http://www.oracle.com/technology/oramag/oracle/04-may/o34tech_plsql.html

and here is how he suggests that you can do it.

Code Listing 5: Creating a DUAL-like table

  1  CREATE TABLE onerow (dummy VARCHAR2(1))
2  /
 3  GRANT SELECT ON onerow TO PUBLIC
4  /
 5  CREATE PUBLIC SYNONYM onerow FOR onerow
6  /
7  CREATE OR REPLACE TRIGGER enforce_onerow
8     BEFORE INSERT
 9     ON onerow
10  DECLARE
11     PRAGMA AUTONOMOUS_TRANSACTION;
12     l_count PLS_INTEGER;
13  BEGIN
14     SELECT COUNT (*)
15       INTO l_count
16       FROM onerow;
17
18     IF l_count = 1
19     THEN
20        raise_application_error
21                        (-20000
22                       , 'The onerow table can have only one row.'
23                        );
24     END IF;
25  END;
26 /


HTH,
--
Magnus Andersen
Systems Administrator / Oracle DBA
Walker & Associates, Inc.

In the may issue of Oracle Magazine, Steven <span class="italicbodycopy"
>Feuerstein
has an article of how to write self managing PL/SQL.&nbsp; In the
article he recommends to not use the dual table but to actually create
your own.&nbsp; You can find the article here:<br>
<br>
<a href="http://www.oracle.com/technology/oramag/oracle/04-may/o34tech_plsql
.html">http://www.oracle.com/technology/oramag/oracle/04-may/o34tech_plsql.html<
/a><br>
<br>
and here is how he suggests that you can do it.<br>
<br>
</span><span class="bodycopy"> Code Listing 5: Creating a DUAL-like table</span>

<p>
</p>
<pre>  1  CREATE TABLE onerow (dummy VARCHAR2(1))<br> 2  /<br>  3  GRANT SELECT
ON onerow TO PUBLIC<br> 4  /<br>  5  CREATE PUBLIC SYNONYM onerow FOR onerow<br
> 6  /<br> 7  CREATE OR REPLACE TRIGGER enforce_onerow<br> 8     BEFORE INSERT
<br>  9     ON onerow<br>10  DECLARE<br>11     PRAGMA AUTONOMOUS_TRANSACTION;
<br>12     l_count PLS_INTEGER;<br>13  BEGIN<br>14     SELECT COUNT (*)<br>15  
   INTO l_count<br>16       FROM onerow;<br>17   <br>18     IF l_count = 1
<br>19     THEN<br>20        raise_application_error<br>21                    
  (-20000<br>22                       , 'The onerow table can have only one row
.'<br>23                        );<br>24     END IF;<br>25  END;
<br>26 /<br></pre>
<br>
HTH,<br>-- <br>Magnus Andersen<br>Systems Administrator / Oracle DBA<br>Walker
&amp; Associates, Inc.