balaji
balaji

Reputation: 41

pl/sql conversion from number to string

i need to convert number to string in pl/sql without using the inbuilt functions , we should use string/module operations for this. for example if the input is 123 then the output should be one hundred and twenty three can anyone give me suggestions about this pls?

Upvotes: 0

Views: 10139

Answers (1)

Ollie
Ollie

Reputation: 17538

You could do this in SQL or PL/SQL using the following:

In SQL:

SELECT to_char(to_date(<number_column>,'j'), 'jsp') 
  FROM <table>;

In PL/SQL:

DECLARE
  v_number NUMBER := 56;
  v_text   VARCHAR2(128);
BEGIN
  v_text := to_char(to_date(v_number,'j'), 'jsp');
END;

More information from AskTom here: http://asktom.oracle.com/pls/apex/f?p=100:11:0::NO::P11_QUESTION_ID:18305103094123#PAGETOP

I suppose it really depends upon what level of "in-built" functions you are going to artificially prevent yourself using and why?

Hope it helps.

Upvotes: 6

Related Questions