I have some oracle calls that I am porting. Today I came across this code which looks like "procedural" language, but is not declared in a function or anything... My question is: Can postgres handle this in this form? What form does this need to be in?
DECLARE
BEGIN
IF :start_time IS NULL OR
:start_date IS NULL OR
:end_time IS NULL OR
:end_date IS NULL THEN
INSERT INTO ARPSPACE_AVAILABILITY
(ARP_ARPSPACE_NM, ASA_TIME_ID, ASA_START_DT, ASA_END_DT)
SELECT :arpspace_name,
1,
ASP.ASP_START_DT,
ASP.ASP_STOP_DT
FROM ASP
WHERE EXISTS
(SELECT ARP.ARP_ARPSPACE_NM
FROM ARPSPACE ARP
WHERE ARP.ARP_ARPSPACE_NM = :arpspace_name);
END IF;
END;