select ejheeid, ejhhourlypayrate, ejhannsalary
from emphJob t1
where ejhjobeffdate=(select max(ejhjobeffdate) from emphJob where ejheeid=t1.ejheeid)
VC
I think he was trying to read 50001 _at most_ in order to avoid reading, say, a million rows.
He mentioned that this trick would work if one wanted to make sure that the table contains _at least_ 50000 rows.
Rgds.
SantaMufasa,
Yes, you're absolutely right -- if the original poster _must_ know the number of rows beforehand, then he's got to run the 'count(*)' query. There is no other way except improving the count(*) query (indexes and such).
VC
zihancool,
What's the real reason for knowing how many rows a resultset contains ?
SantaMufasa,
It's impossible in Oracle (as in SQL Server or DB2) to 'know' how many rows a table contains without running an actual query which can prove to be quite costly and should be avoided if possible...
Well, I am sorry to say but you are wrong:
1. His specific question was whether he can iterate over the record fields (as he showed in his pseudo-code). The answer to this question is NO, Orace does not offer any syntax, in PL/SQL, to loop over a record's fields.
2. Now , if he wants to...
If you want to delete so many rows, it may be more efficient to create a new table with the rows you want to preserve in the nologging mode:
create table t2 nologging as select * from t1 where <rows you want keep>;
drop table t1;
rename t2 to t1;
Rgds.
DBMS_SQL is the only way to handle a result set with
an unknown number and type of columns in PLSQL.
You cannot parse a ref cursor in PL/SQL (although you can in Java, VB, etc.)
Rgds.
Hello,
Given:
t1:
X
-
null
null
null
null
1
2
3
4
5
t2:
X
-
3
4
If you execute 'select * from t1 where x not in (select x from t2);', you will lose all the null values from t1 (as you already know). It's not because of Oracle indexes not storing nulls, but the reason is that the...
Hello,
You can do this so:
select trunc(sysdate-10, 'd')-1 from dual;
E.g.:
select x, trunc(x-10, 'd')-1 from (
select to_date('12/2/03', 'mm/dd/yy') + rownum x from user_objects where rownum<=14);
X TRUNC(X-10,'D')-1
12/3/2003 11/22/2003
12/4/2003 11/22/2003
12/5/2003 11/22/2003...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.