Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Oracle
Hi ,
 
i got one requirement like my client will sent me the values , while storing the values i have to add % symbol to that value.
 
Ex:
 
create table test(payment number)
insert test values(1)
insert test values(2)
insert test values(0.1)
 
select * from test
 
Payment
-------
1%
2%
0.1%
 
how can i achieve the above output.
 
Thanks in advance
Posted 2-Jan-13 19:02pm
Edited 2-Jan-13 20:37pm
v3
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Use this select statement .
 
select to_char([payment number]) || ' %' from test ;
  Permalink  
v2
Comments
FranklinRemo at 3-Jan-13 1:46am
   
Hi RDBurmon , thank you for reply.
 
it is showing the error like 0RA-00936 Missing Expression
RDBurmon at 3-Jan-13 1:59am
   
Can you run this query and send me result ?
SELECT [payment number] FROM test;
FranklinRemo at 3-Jan-13 2:09am
   
Hi it is giving the same error i.e ORA -00936 Missing Expression.
my column name is payment only then how could you specify [payment number].if i write payment also it is giving same error
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

hi i got the answer by writing the query in this format
 
SELECT payment || '%'  FROM test_1;
  Permalink  
v3
Comments
RDBurmon at 3-Jan-13 2:31am
   
Great

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 483
1 OriginalGriff 333
2 Maciej Los 305
3 CHill60 220
4 manoj kumar choubey 184
0 OriginalGriff 6,367
1 Sergey Alexandrovich Kryukov 5,296
2 Maciej Los 3,384
3 Peter Leow 3,259
4 DamithSL 2,490


Advertise | Privacy | Mobile
Web01 | 2.8.140721.1 | Last Updated 3 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100