Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: ORA-01795 although there is just 1 parameter used!
Hi Sybrand,
thank you for your reply.
The CONNECT BY clause is the part of the statement that is responsible for recursion. It causes Oracle to memorize the value of column "col1" (PRIOR col1) and compares it to the current value of column "col8". Using this you can retrieve result sets that are result trees.
The question mark is used for prepared statements in JDBC as a placeholder for one specific value. The SQL statement cache can be used more efficient if the SQL statement is generic.
Example:
"SELECT col1 FROM table WHERE col2 = 5;"
is a different statement as
"SELECT col1 FROM table WHERE col2 = 3;"
The SQL statement cache has to store two access paths, one for each statement. However, these paths are the same. Prepared statements in JDBC are also stored in the SQL statement cache of Oracle. But in this example, Oracle has to store one single access path only:
"SELECT col1 FROM table WHERE col2 = ?;"
In Java it looks like this:
----8<--------------- Java code snippet ------------------------------PreparedStatement stmt = myConnection.prepareStatement("SELECT col1 FROM table WHERE col2 = ?");
// do something with the result set
value = 3;
stmt.setInt(position, value);
result = stmt.executeQuery();
----8<-----------------------------------------------------------------
I cannot tell what is the actual value of the parameter. But I can say, it is one single value -- not 1000+.
Regards,
Johannes
Sybrand Bakker wrote:
> On Tue, 06 Jul 2004 18:08:07 +0200, Johannes Lebek > <reply-to-newsgroup_at_domain.com> wrote: > >
> > > I don't see recursion anywhere. I also don't see the contents of the > parameter referred to by the (?) construct. So: who can tell. > >
> > Yes. > > If yes, why does this apply to subselects but not to >
> > explain what your definition of recursion is. > > >
> > > -- > Sybrand Bakker, Senior Oracle DBAReceived on Wed Jul 07 2004 - 03:05:38 CDT