I seem to remember having some issue creating stored procs and tables,
etc defined in a file with the <sql> task. I think what I had to do is
escape each line like:
create proc foo; \
... \
...
Of course disregard the terrible markup above ;)
Its been quite a few years so I don't remember all the issues but I know
for the procedures I had to escape each line that was part of the
procedure. If memory serves I think it considered each line its own
statement and thus would fail. By escaping each line (for the length of
the procedure) it worked.
Gareth Reakes wrote:
Hey,
I have tried both referencing it by file with the src attribute
and by putting in the sql tag. The file works with the -f option on
the command line with psql (also with redirection).
Cheers,
Gareth
Scot P. Floess wrote:
Sorry sounds like smart alec question...but there is not indication
by what you mean when you say, "sucked in"
Scot P. Floess wrote:
Gareth:
So, you are trying to "suck" this in via ant?
Gareth Reakes wrote:
Hi all,
Apologies if this ends up being a duplicate - It seems this email
was not registered
I am having a problem sucking in a stored procedure. I works
fine on the command line to psql but gives the error
org.postgresql.util.PSQLException: ERROR: unterminated
dollar-quoted string at or near
$update_track_rating_average$
DECLARE
current_average_rating FLOAT"
The first few lines of the stored procedure are:
CREATE OR REPLACE FUNCTION update_track_rating_average() RETURNS
TRIGGER AS $update_track_rating_average$
DECLARE
current_average_rating FLOAT;
number_of_ratings BIGINT;
old_rating SMALLINT;
new_rating SMALLINT;
BEGIN
-- get current average rating / number of ratings
SELECT INTO current_average_rating average_rating FROM tracks
WHERE track_id = OLD.track_id;
SELECT INTO number_of_ratings ratings FROM tracks WHERE
track_id = OLD.track_id;
-- rating removed / updated
IF (TG_OP = 'DELETE' OR TG_OP = 'UPDATE') THEN
I have played with delimiter, delimitertype, escapeprocessing and
keepformat with no luck. Can anyone offer some advice?
Cheers,
Gareth
--
Scot P. Floess
27 Lake Royale
Louisburg, NC 27549
252-478-8087 (Home)
919-754-4592 (Work)
Chief Architect JPlate http://sourceforge.net/projects/jplate
Chief Architect JavaPIM http://sourceforge.net/projects/javapim
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]