Tom,
I don't think there's any very clean way to fix this sort of problem in general. We could make this particular example work if
Frankly, I don't think there *is* any safe way to use volatile functions in subqueries -- I certainly avoid it, except now() and random() which as discussed are special cases. Perhaps a WARNING is in order?
Personally I like Josh's idea. A warning would be a nice thing.
I have just looked at Oracle and SQL Server to find out what those systems are doing ...
Oracle has a very interesting concept *g*:
ORA-02287 sequence number not allowed here:
The usage of a sequence is limited and it can be used only in few areas of PL/SQL and SQL coding.
The following are the cases where you can't use a sequence: For a SELECT Statement: 1. In a WHERE clause 2. In a GROUP BY or ORDER BY clause 3. In a DISTINCT clause 4. Along with a UNION or INTERSECT or MINUS 5. In a sub-query
--------------------------
SQL Server does not support sequences the way we know it so it is hard to compare.
I did not have time to test DB2 yet.
Thanks a lot,
Hans
-- Cybertec Geschwinde u Schoenig Schoengrabern 134, A-2020 Hollabrunn, Austria Tel: +43/720/10 1234567 or +43/660/816 40 77 www.cybertec.at, www.postgresql.at, kernel.cybertec.at
---------------------------(end of broadcast)--------------------------- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly