Old Junior
Old Junior

Reputation: 1

How do I list numbers -for example from 1 to 20- in a LOV item by using pl/SQL function? Return values are same as display values

I'm trying to list numbers -for example from 1 to 20- in a LOV item by using a loop in a pl/SQL function. It must be possible but I haven't succeeded yet. Thanks for your precious helps.

Upvotes: 0

Views: 427

Answers (1)

Koen Lostrie
Koen Lostrie

Reputation: 18640

No need to do pl/sql, this can be achieved using the pseudo column LEVEL and the CONNECT BY clause in pure SQL. Very useful for selects like date lists, number lists, etc. For a list of numbers from 1 to 20 you could do this:

SELECT
  level  AS display_value,
  level  AS return_value
  FROM
  dual
CONNECT BY
  level <= 20

Upvotes: 1

Related Questions