Re: Help on SQL query

From: Rajesh Jayaprakash <rajesh.j_at_vsnl.net>
Date: 19 Jan 2002 01:50:08 -0800
Message-ID: <59dd274f.0201190150.4f124e0c_at_posting.google.com>


M.CAMBA_at_terra.es (Miguel Camba) wrote in message news:<3c48c2d3.1826138_at_news.terra.es>...
> I have an Oracle 8.1.6 table PURCHASEORDERST
>
> CHANGEDATE DATE
> PURCHASEORDER VARCHAR2(20)
> STATUS VARCHAR2(2)
>
> Primary key on (CHANGEDATE, PURCHASEORDER)
>
> When purchase order staus change a trigger insert a record in
> PURCHASEORDERST table.
>
> V1, v2 are valid status; N1, N2 are not valid status.
>
> I got a date like a parameter; I need know if the last status before
> the parameter is a valid status or not.
>
> Thanks.

I am not sure if I understand your requirement clearly, so my suggestion may be off the mark, but anyway, here goes:

You can access the CHANGEDATE and the PURCHASEORDER fields of the to-be-updated record from the trigger. You can run a select statement for obtaining the last status based on the PURCHASEORDER field (select the record with the latest CHANGEDATE for the given PURCHASEORDER) and then check if this is a valid status or not, taking appropriate action based on this.

Regards,

Rajesh Received on Sat Jan 19 2002 - 10:50:08 CET

Original text of this message