Re: [SQL] [JDBC] Prepare Statement

2004-06-17 Thread Jie Liang
Kris, I have another question, I saw some discussion regarding PreparedStatement work with array argument, I get a error when I try to play with it. E.g. I have myfunction(int[]), So, PrepareStatement st = conn.prepareStatment("SELECT myfunction(?)"); String arr="{1,2,3}"; St.setString(1,arr}; Res

Re: [SQL] [JDBC] Prepare Statement

2004-06-17 Thread Jie Liang
Hmm, intersting. I am using jdk 1.3.1, and pg74.213.jdbc2.jar driver, I hope this bug could be fixed in later version. Thanks. Jie Liang -Original Message- From: Kris Jurka [mailto:[EMAIL PROTECTED] Sent: Thursday, June 17, 2004 3:26 PM To: Jie Liang Cc: Tom Lane; [EMAIL PROTECTED]; [

Re: [SQL] [JDBC] Prepare Statement

2004-06-17 Thread Jie Liang
Kris, You are right, I modified that piece of code a little bit, CallableStatement stmt = conn.prepareCall("{?=call chr(?)}"); Then my log file were: Select * from chr(65) as result; Select * from chr(66) as result; .. However, if I use: PrepareStatement stmt = conn.prepareStatement("SELECT chr

Re: [SQL] Optimal query suggestion needed

2004-06-17 Thread Bruno Wolff III
On Thu, Jun 17, 2004 at 22:22:34 +0300, InterZone <[EMAIL PROTECTED]> wrote: > > Thanks > the query you sent failed on v. 7.4, so I added an "end" to the case > statement. I selected from the tables and the results seem to be correct. That was an unintentional typo. > > I rewrite it for arch

Re: [SQL] Optimal query suggestion needed

2004-06-17 Thread InterZone
Bruno Wolff III wrote: On Thu, Jun 17, 2004 at 14:46:08 +, Interzone <[EMAIL PROTECTED]> wrote: I want to create a view that will have: from table t0 the elements "code", "address" and "mun" from table t1 the elements "code" and "pname" from table t2 the total number of elements, and the tot

Re: [SQL] Optimal query suggestion needed

2004-06-17 Thread InterZone
Richard Huxton wrote: Interzone wrote: Hi all, I'm trying to create a view for a client, but I'm failing miserably so I thought I'ld ask for some help. The initial analysis was quite complicated, and that specific need never came up until recently, and unfortunately, changing the tables is prob

Re: [SQL] [JDBC] Prepare Statement

2004-06-17 Thread Jie Liang
Kirs, I re-compile with setUseServerPrepare(true), it works fine, thanks. However, reading from my log file, what I saw is that five same SELECTs with different argument, so I am wondering that the PrepareStatement really save time than individualy execute five SELECTs ??? If I use one "parepare

Re: [SQL] Optimal query suggestion needed

2004-06-17 Thread Bruno Wolff III
On Thu, Jun 17, 2004 at 14:46:08 +, Interzone <[EMAIL PROTECTED]> wrote: > I want to create a view that will have: > from table t0 the elements "code", "address" and "mun" > from table t1 the elements "code" and "pname" > from table t2 the total number of elements, and the total number of >

Re: [SQL] use of a composite type in CREATE TABLE?

2004-06-17 Thread Tom Lane
Hannes Korte <[EMAIL PROTECTED]> writes: > does anyone know how it is posible to set a composite type as the data > type of a column when creating a new table? Use 7.5 ;-). It's not supported in any existing release, but it does work in CVS tip ... regards, tom lane ---

Re: [SQL] Optimal query suggestion needed

2004-06-17 Thread Richard Huxton
Interzone wrote: Hi all, I'm trying to create a view for a client, but I'm failing miserably so I thought I'ld ask for some help. The initial analysis was quite complicated, and that specific need never came up until recently, and unfortunately, changing the tables is probably not an option :(

[SQL] Optimal query suggestion needed

2004-06-17 Thread Interzone
Hi all, I'm trying to create a view for a client, but I'm failing miserably so I thought I'ld ask for some help. The initial analysis was quite complicated, and that specific need never came up until recently, and unfortunately, changing the tables is probably not an option :( Given the tables

[SQL] use of a composite type in CREATE TABLE?

2004-06-17 Thread Hannes Korte
Hi, does anyone know how it is posible to set a composite type as the data type of a column when creating a new table? CREATE TABLE tbl1 ( name VARCHAR(60) NOT NULL, address comp_type_address ); The exmaple above does not work. Any help is appreciated. -- Regards, Hannes -