Write a query that displays the annual salaries with asterisks for all employees. Each asterisks signifies a thousand dollars. please explain the query.

Questions by san2007   answers by san2007

Showing Answers 1 - 6 of 6 Answers

shakthi

  • Jan 30th, 2007
 

TO_CHAR(number, ?format_model?);These are some of the format elements you can usewith the TO_CHAR function to display a number valueas a character:9 Represents a number0 Forces a zero to be displayed$ Places a floating dollar signselect to_char(salary,'$99,999.00') from employee;

  Was this answer useful?  Yes

raj

  • Jan 31st, 2007
 

create a table that sal columns data type should be as varchar
create table test (name varchar2(20), sal varchar2(10));

insert into test values( '&name',to_char(&sal,'9,999$' );

  Was this answer useful?  Yes

Rajeev Sharma

  • Feb 21st, 2007
 

Try this and revrt--
select lpad('',len(round(5000/1000)),'*') from dual;

  Was this answer useful?  Yes

orlando

  • Feb 28th, 2007
 

Hi, Rajeev Sharma,
Why I alway got none of * with your statement? I have to use '*" for first param. 
 LPAD('*', TRUNC(salary/1000, 0), '*')

Is it because of the 9i that I am using?

Thanks.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions