By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,769 Members | 1,165 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,769 IT Pros & Developers. It's quick & easy.

to_char problem

P: n/a
I get compile error for this code:
for i in 1..arg_count-1 LOOP
RAISE NOTICE quote_literal(to_char(i, ''9''));
END LOOP;

where arg_count = 3.

I tried RAISE NOTICE to_char(i, ''9''); as well.
to_char returns text, right? Then what did I do wrong here?
Wei

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 22 '05 #1
Share this Question
Share on Google+
3 Replies

P: n/a
On Monday 16 February 2004 19:15, Wei Wang wrote:
I get compile error for this code:
for i in 1..arg_count-1 LOOP
RAISE NOTICE quote_literal(to_char(i, ''9''));
END LOOP;

where arg_count = 3.

I tried RAISE NOTICE to_char(i, ''9''); as well.
to_char returns text, right? Then what did I do wrong here?


Syntax is a little peculiar, you need to do something like

RAISE NOTICE ''hello % world %'',i,j;

Nothing else will do.

--
Richard Huxton
Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 22 '05 #2

P: n/a
In that case, how do I RAISE NOTICE a text variable such as:
DECLARE tempstring text;
BEGIN
RAISE NOTICE tempstring;
END
----- Original Message -----
From: "Richard Huxton" <de*@archonet.com>
To: "Wei Wang" <ww***@cam.ac.uk>; "pgsql" <pg***********@postgresql.org>
Sent: Monday, February 16, 2004 8:24 PM
Subject: Re: [GENERAL] to_char problem

On Monday 16 February 2004 19:15, Wei Wang wrote:
I get compile error for this code:
for i in 1..arg_count-1 LOOP
RAISE NOTICE quote_literal(to_char(i, ''9''));
END LOOP;

where arg_count = 3.

I tried RAISE NOTICE to_char(i, ''9''); as well.
to_char returns text, right? Then what did I do wrong here?


Syntax is a little peculiar, you need to do something like

RAISE NOTICE ''hello % world %'',i,j;

Nothing else will do.

--
Richard Huxton
Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org


---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 22 '05 #3

P: n/a
On Tuesday 17 February 2004 12:37, Wei Wang wrote:
In that case, how do I RAISE NOTICE a text variable such as:
DECLARE tempstring text;
BEGIN
RAISE NOTICE tempstring;


RAISE NOTICE ''%'',tempstring;

Don't forget to double-up (or bacslash-escape) your quotes.

--
Richard Huxton
Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 22 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.