Re: T-SQL to PL-SQL

From: John Hurley <hurleyjohnb_at_yahoo.com>
Date: Mon, 26 Apr 2010 13:46:07 -0700 (PDT)
Message-ID: <db2edb94-2b67-4ce7-a157-d81919b0bfbb_at_l6g2000vbo.googlegroups.com>



Stu:

> Hello everyone,
> how could i translate this code to pl-sql.
>
>   update DM_RE_JOB_POSTING
>   set    publishedI = (
>     select CASE WHEN rjp.internal_external in ('B','I')
>                  and
> COALESCE(rjpd.start_date,'17530101'             )
> <= CURRENT_TIMESTAMP
>                  and COALESCE(rjpd.end_date  ,'99991231
> 23:59:59.997')
>
> >= CURRENT_TIMESTAMP
>
>                 THEN 'I' ELSE 'N' END
>     from re_job_posting rjp
>     join re_job_posting_details rjpd on rjpd.re_job_posting_id =
> rjp.id
>     where rjp.id        = DM_RE_JOB_POSTING.ref_re_job_posting_id
>     and   rjpd.internal = 1
>   ),     publishedE = (
>     select CASE WHEN rjp.internal_external in ('B','E')
>                  and
> COALESCE(rjpd.start_date,'17530101'             )
> <= CURRENT_TIMESTAMP
>                  and COALESCE(rjpd.end_date  ,'99991231
> 23:59:59.997')
>
> >= CURRENT_TIMESTAMP
>
>                 THEN 'E' ELSE 'N' END
>     from re_job_posting rjp
>     join re_job_posting_details rjpd on rjpd.re_job_posting_id =
> rjp.id
>     where rjp.id = DM_RE_JOB_POSTING.ref_re_job_posting_id
>     and   rjpd.internal = 0
>   )

I don't see any T-SQL in what you supplied. Looks like 1 SQL statement to me.

How would you rewrite 1 SQL statement to another SQL statement?

This looks suspiciously like homework to me.

Oracle supports CASE statement. Why don't you post what you come up with as an equivalent? Received on Mon Apr 26 2010 - 15:46:07 CDT

Original text of this message