[SQL] drop sequence in transaction

2000-09-04 Thread Ice Planet

Hello

I have a litle problem with sequences.
I use drop sequence in transaction, is this possible?

If yes, then i have done:
1. begin
2. get some data
3. drop sequence s_acc
4. create sequence s_acc...
5. rollback

And after this the database responds like this:

test=# \d s_acc
Sequence "s_acc"
   Attribute   |  Type
---+-
 sequence_name | name
 last_value| integer
 increment_by  | integer
 max_value | integer
 min_value | integer
 cache_value   | integer
 is_cycled | char
 is_called | char

test=# select * from s_acc;
NOTICE:  mdopen: couldn't open s_acc: No such file or directory
NOTICE:  mdopen: couldn't open s_acc: No such file or directory
NOTICE:  mdopen: couldn't open s_acc: No such file or directory
NOTICE:  mdopen: couldn't open s_acc: No such file or directory
NOTICE:  mdopen: couldn't open s_acc: No such file or directory
ERROR:  cannot open relation s_acc
test=# select last_value from s_acc;
NOTICE:  mdopen: couldn't open s_acc: No such file or directory
NOTICE:  mdopen: couldn't open s_acc: No such file or directory
NOTICE:  mdopen: couldn't open s_acc: No such file or directory
NOTICE:  mdopen: couldn't open s_acc: No such file or directory
ERROR:  cannot open relation s_acc
test=#

I realy don't know what means this?

Thank's for help...

       Best regards
  Ice Planet

e-mail: [EMAIL PROTECTED]
ICQ#: 67765483





[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 do this insert???

Thanks for help

   Best regards
  Ice Planet

e-mail: [EMAIL PROTECTED]
ICQ#: 67765483





[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(division_point) from table1)

Division_point is in format numeric (40,4). But the number is sometimes small and 
sometimes big, when the number is big, then is all OK, but when the number is small i 
got error message that / for float8 (!) and numeric is not possible and i must 
use explicit typecast, but i dont know how! I have look in manual, but there are 
informations about float8 only and at the bottom is written that most of functions for 
float8 works for numeric so i try:

select numeric (TheNumberFromConsole)/(select max(division_point) from table1)

But this don't work too...

Please help how should i written the statement correct.

Thanks for help and sorry for my bad english.

   Best regards
      Ice Planet

e-mail: [EMAIL PROTECTED]
ICQ#: 67765483