Hi all,
I am creating a query which will run every day at a specific time. My database is Oracle 8i. I need to know the last unique key the system used the previous day. My script looks like this:
select max(orderdetail.orderkey) from orderdetail,orders
where orderdetail.orderkey=orders.orderkey
and orderdetail.status = '0'
and orders.type = '0'
and orderdetail.adddate > (sysdate-1)
and orders.externorderkey not like 'M-%';
For example, the unique keys are assigned by the system as following:
0000001
0000002
0000003
0000004
0000005
and so on. With these unique keys, the script must be able to identify 0000005 is the last number was used. The script runs once a day at the same time using Windows Scheduler.
Could someone help me with this as my script does not pull the right record?
Thanks..
I am creating a query which will run every day at a specific time. My database is Oracle 8i. I need to know the last unique key the system used the previous day. My script looks like this:
select max(orderdetail.orderkey) from orderdetail,orders
where orderdetail.orderkey=orders.orderkey
and orderdetail.status = '0'
and orders.type = '0'
and orderdetail.adddate > (sysdate-1)
and orders.externorderkey not like 'M-%';
For example, the unique keys are assigned by the system as following:
0000001
0000002
0000003
0000004
0000005
and so on. With these unique keys, the script must be able to identify 0000005 is the last number was used. The script runs once a day at the same time using Windows Scheduler.
Could someone help me with this as my script does not pull the right record?
Thanks..