Home » SQL & PL/SQL » SQL & PL/SQL » query
query [message #241760] Wed, 30 May 2007 10:12 Go to next message
getritesh
Messages: 235
Registered: July 2006
Location: INDIA
Senior Member

Can anyone please tell me a simple query

which in gives back number in numeral given a number in words to the query and vice versa
Re: query [message #241765 is a reply to message #241760] Wed, 30 May 2007 10:27 Go to previous messageGo to next message
DreamzZ
Messages: 1666
Registered: May 2007
Location: Dreamzland
Senior Member
give some example how you want your result?
Re: query [message #241772 is a reply to message #241765] Wed, 30 May 2007 10:35 Go to previous messageGo to next message
getritesh
Messages: 235
Registered: July 2006
Location: INDIA
Senior Member

Suppose u give character 'TEN' as input u it should give 10 as output
Re: query [message #241778 is a reply to message #241772] Wed, 30 May 2007 10:49 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
Sorry, an RDBMS is actually built for other things..
Re: query [message #241779 is a reply to message #241760] Wed, 30 May 2007 10:51 Go to previous messageGo to next message
Michel Cadot
Messages: 64133
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
There is no simple query (althought it exists for small numbers) but you can easely create a PL/SQL procedure for that.

Regards
Michel
Re: query [message #241780 is a reply to message #241778] Wed, 30 May 2007 10:54 Go to previous messageGo to next message
Frank Naude
Messages: 4502
Registered: April 1998
Senior Member
How about something like this:

SQL> CREATE TABLE t1 (words VARCHAR2(30));

Table created.

SQL> INSERT INTO t1 VALUES ('TWO');

1 row created.

SQL> INSERT INTO t1 VALUES ('TEN');

1 row created.

SQL> SELECT words, DECODE(words, 'TWO', 2, 'TEN', 10) AS "Number" FROM t1;

WORDS                              Number
------------------------------ ----------
TWO                                     2
TEN                                    10
Re: query [message #241838 is a reply to message #241780] Wed, 30 May 2007 13:02 Go to previous messageGo to next message
vggraj
Messages: 3
Registered: May 2007
Junior Member
For Number to words use

SELECT TO_CHAR(TO_DATE(100,'J'),'JSP') to_words
FROM dual;

Refer the link: http://www.singlequery.com/?p=116

Govind
Re: query [message #241841 is a reply to message #241838] Wed, 30 May 2007 13:05 Go to previous message
Michel Cadot
Messages: 64133
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
SQL> SELECT TO_CHAR(TO_DATE(10000000,'J'),'JSP') to_words from dual;
SELECT TO_CHAR(TO_DATE(10000000,'J'),'JSP') to_words from dual
                       *
ERROR at line 1:
ORA-01830: date format picture ends before converting entire input string

Regards
Michel
Previous Topic: how to know the time of creation of column
Next Topic: query giving error of spool space
Goto Forum:
  


Current Time: Thu Dec 08 04:23:05 CST 2016

Total time taken to generate the page: 0.08998 seconds