How to format a character to look like an amount -solved


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to format a character to look like an amount -solved
# 1  
Old 04-12-2010
How to format a character to look like an amount -solved

Hi All,

I want to format the retrieved varchar2 value in the database to $9,999,999,990.00 but remained as a character value. Is it possible?

Example: 378273.23 to $378,273.23

below is the code i want to implement:
Code:
sqlplus -s ${USERNAME}/${PASSWORD}@${ORACLE_SID} << END1 >> $LOGFILE
whenever sqlerror exit
set serveroutput on size 1000000

declare
  l_rc          varchar2(1)   := null;
  l_msg         varchar2(50)  := null;
  l_note        varchar2(254) := null;
  l_tvx_recs    integer       := 0;
  cursor c1 is
    select first_name as acct_id,
           call_stus_desc as call_status_description,
           cntctd_date as contacted_date,
           cntctd_time as contacted_time,
           appt_notes as delinquency_amount
      from sr11007_call_results_table;
begin
  dbms_output.enable(1000000);
  for i in c1 loop
      l_tvx_recs := l_tvx_recs + 1;   
      l_note := 
         trim(i.contacted_date) || ' ' ||
         trim(i.contacted_time) || ' regarding ' ||
         trim(i.delinquency_amount,'$9,999,999,990.00')  || ' ' ||
         trim(i.call_status_description);



---------- Post updated at 12:13 PM ---------- Previous update was at 12:04 PM ----------

Hi guys, i come up a solution by the use of to_number. case is closed
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

[Solved] Extract First character in fourth column

Hi Experts, I am new to UNIX. One of my file records are like below 220 IN C/A 515013 NULL NULL 220 IN C/A 515017 NULL NULL 225 IN C/A 333701 NULL NULL 225 IN C/A 515034 NULL NULL 225 IN C/A 499201 NULL NULL 225 IN C/A 499202 NULL NULL The above mentioned records delimiter is... (4 Replies)
Discussion started by: suresh_target
4 Replies

2. UNIX for Dummies Questions & Answers

[Solved] Find position of character with awk

Hi Guys! Could anyone help me with?.. I have a line which says BCVGF%6$#900 .....How can we know which position is for % or say $ by command or script?There is any way to get a prompt by any script? Thanks a lot (6 Replies)
Discussion started by: Indra2011
6 Replies

3. UNIX for Dummies Questions & Answers

[Solved] Removing an 8 character string

Edit: Figured it out. Close the thread please. Solution: \{8}\] edit by bakunin: no need to close the thread, but i changed the title to SOLVED. Thanks for writing a follow-up. (0 Replies)
Discussion started by: unknownn
0 Replies

4. Shell Programming and Scripting

[SOLVED] Converting data from one format to the other

Hi All, I need to convert an exel spreadsheet into a SAS dataset, and the following format change is needed. Please help, this is too complex for a biologist. Let me describe the input. 1st row is generation.1st column in keyword 'generation', starting 2nd column there are 5... (9 Replies)
Discussion started by: newbie83
9 Replies

5. Shell Programming and Scripting

[Solved] Need help changing a field from MM/DD/YY to DD/MM/YY format

Hi, I need help changing a field from MM/DD/YY to DD/MM/YY format. Suppose a file a.csv. The record is "11/16/09","ABC"," 1","EU","520892414","1","600","31351000","1234567","ANR BANK CO. LTD" "11/16/09","PQR"," 2","EU","520892427","1","600","31351000","5467897","ANR BANK CO.... (4 Replies)
Discussion started by: Gangadhar Reddy
4 Replies

6. UNIX for Dummies Questions & Answers

[Solved] Count amount of times of appearing of character before a word?

Hello Is there a way to calculate how many times a particular symbol appeared in a string before a particular word. Desktop/Myfiles/pet/dog/puppy So, I want to count number of occurence of"/" in this directory before the word dog lets say. Cheers, Bob (3 Replies)
Discussion started by: FUTURE_EINSTEIN
3 Replies

7. UNIX for Dummies Questions & Answers

[Solved] delete character in vi file

I have a file with lots of unnecessary double quotes ("). I tried to remove them but not successful. Please assist. Thanks! (3 Replies)
Discussion started by: onlinelearner02
3 Replies

8. Shell Programming and Scripting

[Solved] sed : last character replace

Hi all , I have to write a shell script that takes a number as input , like 123 and the output will be 6 ,i.e the output will be the sum of digits of the input. I have an idea as follows, echo "123"|fold -1|tr '\n' '+'|bc But the problem is after " echo "123"|fold -1|tr '\n' '+' "... (5 Replies)
Discussion started by: M.Choudhury
5 Replies

9. Shell Programming and Scripting

How to format sql result as amount - ksh

I am currently returning an sql result with a number value that I want to format as an amount. The sql runs smoothly on its own, but when run inside my ksh script an error is encountered: ERROR at line 3: ORA-01481: invalid number format model My sql is -- select distinct ... (6 Replies)
Discussion started by: avillanueva
6 Replies

10. Shell Programming and Scripting

reply amount to another format

hello, i have a txt file called a.txt with million of records...I would like to change amount field (last two field)..if it displayed ".00" changed to "0.00" and displayed ".51" changed to "0.51" example of a.txt RECORD ID,CLIENT,CUSTOMER NAME,2883,12:05,8, 16.39, 191.34 RECORD... (10 Replies)
Discussion started by: happyv
10 Replies
Login or Register to Ask a Question