Re: [SQL] Type conversion from TEXT to DOUBLE PRECISION

2004-01-09 Thread Daniel Lau
On Fri, 9 Jan 2004, Tom Lane wrote: > Richard Huxton <[EMAIL PROTECTED]> writes: > > Since your error seems to be complaining about a space, I'd guess you've got > > other than numeric values in _aaa. > > In fact, with a bit of experimentation I see the same error message: > > regression=# sel

Re: [SQL] Type conversion from TEXT to DOUBLE PRECISION

2004-01-09 Thread Tom Lane
Richard Huxton <[EMAIL PROTECTED]> writes: > Since your error seems to be complaining about a space, I'd guess you've got > other than numeric values in _aaa. In fact, with a bit of experimentation I see the same error message: regression=# select to_number('12345', '9'); to_number

Re: [SQL] Type conversion from TEXT to DOUBLE PRECISION

2004-01-09 Thread Richard Huxton
On Friday 09 January 2004 07:35, Daniel Lau wrote: > Hi all, > > Thank you for reading this mail. > > I am trying to do the following: > Extract the first half of _aaa and put it in column _bbb > Varchar[10] | Double Precision > _aaa _bbb > 1234567890 > I used two functions t

Re: [SQL] Type conversion from TEXT to DOUBLE PRECISION

2004-01-09 Thread Tom Lane
Daniel Lau <[EMAIL PROTECTED]> writes: > I used two functions to do it: substring() and to_number(). The SQL is > like this: > UPDATE _table SET _bbb = to_number(substring(_aaa from 1 for 5), '9'); > The machine fails me and said > ERROR: invalid input syntac for type numeric: " " Works for me

[SQL] Type conversion from TEXT to DOUBLE PRECISION

2004-01-09 Thread Daniel Lau
Hi all, Thank you for reading this mail. I am trying to do the following: Extract the first half of _aaa and put it in column _bbb Here is the table, named: _table: Varchar[10] | Double Precision _aaa_bbb _ 1234567890 I used two function

[SQL] type conversion needed

2003-11-18 Thread Kishore Thota (kthota)
Title: Message How to convert bytea data type to character varying and vice versa   looking forward for ur assistance   kishore

Re: [SQL] Type conversion

2000-07-10 Thread Thomas Lockhart
> select TheNumberFromConsole/(select max(division_point) from table1) Try select '1234.5678'/(select max(division_point) from table1); The quotes around the apparent floating point number keeps Postgres from assuming that it *is* a floating point number, and it later decides that it must hav

[SQL] Type conversion

2000-07-10 Thread Ice Planet
Hello I have one big select that computes some value. The value is in format numeric (40,4). Then is this value send to console and when someone on console agree with the number then is the number send to database where i need to do something like this select TheNumberFromConsole/(select max(

Re: [SQL] Type conversion

2000-06-20 Thread Ed Loehr
Tom Lane wrote: > > Ice Planet <[EMAIL PROTECTED]> writes: > > B: insert into t2 values (select int2(int4(b)) from t1 where a = 1) > > Works for me when spelled correctly: I think you can also leave out the 'values' for a sub-select insert, though I haven't checked to see if it matters... Rega

Re: [SQL] Type conversion

2000-06-20 Thread Tom Lane
Ice Planet <[EMAIL PROTECTED]> writes: > B: insert into t2 values (select int2(int4(b)) from t1 where a = 1) Works for me when spelled correctly: regression=# insert into t2 (select int2(int4(b)) from t1 where a = 1); INSERT 314647 1 If you make a suitable conversion function then you can omit

[SQL] Type conversion

2000-06-20 Thread Ice Planet
Hello I have following situation create table t1 (a int8 primary key, b int8); create table t2 (x int2); insert into t1 values (1,1); A: insert into t2 values (select b from t1 where a = 1) B: insert into t2 values (select int2(int4(b)) from t1 where a = 1) Both possibilites fail, how can i d