Some information about JDBC

Поиск
Список
Период
Сортировка
Искать

Some information about JDBC

От:
"Ing. Arturo de la Torre" <adltor@waccom.net.ec>
Дата:
Hi  :-)

I am making some probes with JDBC, please if some body have some
examples please send me

Sincerely

Arturo

Confusion in Insert Query syntax

От:
Shadkam Islam <shadkam@wipinfo.soft.net>
Дата:
Hi All,

If I type \h insert at psql it shows me,

        INSERT INTO class_name [(attr1, ...attrN)]
        VALUES (expr1,..exprN) |
        SELECT [DISTINCT [ON attrN]]
        expr1, ...exprN
        [FROM from_clause]
        [WHERE qual]
        [GROUP BY group_list]
        [HAVING having_clause]
        [ { UNION [ALL] | INTERSECT | EXCEPT } SELECT ...];


But when I tried the following query it gave the parse error


	INSERT INTO EffortTable (EffortID)
	VALUES (ValueForEffortID) |
	SELECT MAX(EffortID) AS ValueForEffortID
	FROM   EffortTable
	WHERE  ProjectID=200;

the error is --> ERROR:  parser: parse error at or near "|"


What is the syntax I should use.

Thanx in advance,
Shad.

Re: [GENERAL] Confusion in Insert Query syntax

От:
Bruce Momjian <maillist@candle.pha.pa.us>
Дата:
> Hi All,
> 
> If I type \h insert at psql it shows me,
> 
>         INSERT INTO class_name [(attr1, ...attrN)]
>         VALUES (expr1,..exprN) |
>         SELECT [DISTINCT [ON attrN]]
>         expr1, ...exprN
>         [FROM from_clause]
>         [WHERE qual]
>         [GROUP BY group_list]
>         [HAVING having_clause]
>         [ { UNION [ALL] | INTERSECT | EXCEPT } SELECT ...];
> 
> 
> But when I tried the following query it gave the parse error
> 
> 
> 	INSERT INTO EffortTable (EffortID)
> 	VALUES (ValueForEffortID) |
> 	SELECT MAX(EffortID) AS ValueForEffortID
> 	FROM   EffortTable
> 	WHERE  ProjectID=200;
> 

The | means 'or' meaning INSERT INTO table VALUES    or  INSERT INTO
table SELECT.

-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
FAQ