Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Dynamic variables in SQL query

User0484Feb 10 2020 — edited Feb 10 2020

Hi Folks,

Probably not much versed in SQL/PL/SQL, as I am seeking a bit of a hints here. I have put together a query which runs fine when I am passing a fixed value, like below:

.....

VAR issueId number
  exec :issueId :='41'
  SELECT
      Id AS Key, LayoutId AS Value
  FROM
      CBS_BRIEFS
  WHERE
      IssueId = :issueId
      AND EditionCode = (SELECT EditionCode FROM CBS_BRIEFS WHERE Id = 21)

....

==> Yet, I am looking after a way of having issueId out of a query like:

issueId := (SELECT IssueId FROM CBS_BRIEFS WHERE Id = 21)

instead of having assigned fixed values.

Any clues would be appreciated.

Thanks in advance

This post has been answered by Cookiemonster76 on Feb 10 2020
Jump to Answer
Comments
Post Details
Added on Feb 10 2020
10 comments
540 views