0

I have a table with a column like: A1 A2 . . B1 .. B7

I need to generate this column randomly. This column type is CHAR(2). I tried using TRUNC(dbms_random.value(65,67)) and then ascii function for the letter part of the char but it has not worked. Can you please help me generate A1-A7, B1-B7 randomly?

1 Answer 1

1

You need the CHR funciton instead of ASCII, this should work:

   CHR(TRUNC(dbms_random.value(65,67)))  -- A..B
|| CHR(TRUNC(dbms_random.value(49,56)))  -- 1..7
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.