Re: Problem in manipulating a record




"Sandy80" <svarshneymail@xxxxxxxxx> a écrit dans le message de news: 1174900357.635066.243210@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
| Hi,
|
| I have a requirement to manipulate a record as follows:
|
| If the record is 22.85 I need to generate the value 0228500 from this
| record i.e. I need to take 3 values before the decimal point and 4
| values after the decimal point replacing any missing value with a
| zero.
| I am doing the manipulation as follows:
|
| nvl(lpad(substr (rul.mid_value,0,INSTR(rul.mid_value, '.')-1 ),3,0) ||
| rpad(substr (rul.mid_value,INSTR(rul.mid_value, '.')+1,4),
| 4,0),'0000000')||
|
| Now the issue is that I have a record as 22 which does not have a
| decimal point and that is why the above manipulation is failing. The
| record cannot be changed and I somehow need to change my manipulation.
|
| Any ideas??
|
| Thanks,
| Sandy
|

SQL> select replace(to_char(22.85,'fm000.0000'),'.','') from dual;
REPLACE(T
---------
0228500

1 row selected.

SQL> select replace(to_char(22,'fm000.0000'),'.','') from dual;
REPLACE(T
---------
0220000

1 row selected.

Regards
Michel Cadot


.



Relevant Pages

  • [ECHO_ADV_102$2009] BusinessSpace <= 1.2 (id) Remote SQL Injection Vulnerability
    ... Manipulation of data / Exposure of sensitive information ... in sql queries.This vulnerability can be exploited to manipulate SQL queries by injecting arbitrary SQL code. ... Successful exploitation allows attacker retrieving users email and password in plain text. ...
    (Bugtraq)
  • Re: Need help with Tricky SELECT statements please.
    ... >> I was also taught early that it was best to do as much manipulation ... using SQL as possible. ... concatenated string as output. ... constraints, Declarative Referential Integrity, datatypes, etc. in your ...
    (microsoft.public.sqlserver.programming)
  • Re: Need help with Tricky SELECT statements please.
    ... and where it does not belong in a properly tiered architecture. ... much manipulation using SQL as possible. ... The best example was tree processing. ...
    (microsoft.public.sqlserver.programming)
  • Re: Data Access...
    ... Someone coming to .NET from and SQL compliant language would ... Data manipulation, navigation, etc... ... Most word processors don't have databases in ... Not every application needs a database. ...
    (microsoft.public.dotnet.framework)
  • Mafia Moblog Full Path Disclosure / SQL injection
    ... Discovred By:Moroccan Security Research Team (Simo64) ... Manipulation of data, System access ... This can be exploited to manipulate SQL queries by injecting arbitrary SQL code. ...
    (Bugtraq)