473,795 Members | 2,865 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

to_char problem

I get compile error for this code:
for i in 1..arg_count-1 LOOP
RAISE NOTICE quote_literal(t o_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
3 2519
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(t o_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*******@postg resql.org

Nov 22 '05 #2
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.c om>
To: "Wei Wang" <ww***@cam.ac.u k>; "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(t o_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*******@postg resql.org


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

Nov 22 '05 #3
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 ''%'',tempstrin g;

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*******@postg resql.org so that your
message can get through to the mailing list cleanly

Nov 22 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
5684
by: Amin Schoeib | last post by:
Hi, Can somebody tell me why this query don't work when I use to_date Instead of to_char By using to_char: select to_char(last_day(cast(current_date - interval '1 month' as date)),'DD.MM.YYYY') ;
3
18396
by: Praveen | last post by:
Hi All, I have some procedures which written in Oracle. Now the requirement has come to convert those procedures into db2. I used IBM provided MTK tool to convert the procedures. The tool has given the syntax for TO_DATE function. When i tried to execute in db2 command line prompt, it says an error... db2 => select ORA8.TO_DATE(ORA8.TO_CHAR(CURRENT TIMESTAMP , 'mm-dd-yyyy'), 'mm-d
2
9238
by: Mark Hansen | last post by:
I'm trying to convert some schema creation scripts that were used on MS SQL Server to DB2 (v8.2) and have a problem with the following select statement (snippet) used for a view: SELECT col1, col2, timestamp-col1, TO_CHAR(timestamp-col1, 'HH24') FROM ...
4
24427
by: gimme_this_gimme_that | last post by:
What is the DB2 equivalent syntax of Oracle's : select to_char(created_date,'MM/DD/YYYY') from foo Thanks
2
2746
by: Clark Endrizzi | last post by:
I just sent this twice before with the wrong email address so it didn't go through, that is why I am sending this so that it will get through. I hope this isn't causing issues. Hi guys. I certainly hope this is the correct place to email this. I'm having an issue that I have really tried to solve but can't. I'm using RHEL's postgresql 7.3.4 and everything works great except my to_char() statements. The most common conversion string...
0
1082
by: Clark Endrizzi | last post by:
Hi guys. I certainly hope this is the correct place to email this. I'm having an issue that I have really tried to solve but can't. I'm using RHEL's postgresql 7.3.4 and everything works great except my to_char() statements. The most common conversion string I use is 'MM/DD/YYYY HH:MM AM' which works except the minutes are never correct, they always end with ":04". So if I submitted it at 10:23 AM it will say 10:04 after conversion....
14
3529
by: Najib Abi Fadel | last post by:
Hi, i am using PostgreSQL 7.3.2 there's a bug for the date '2005-03-27' !!!!!!!!!!!!!!!!!!!!!!!!!!! SELECT to_char('2005-03-27'::date,'DD/MM/YYYY'); to_char ------------ 26/03/2005 (1 row)
1
17245
by: Eitan M | last post by:
Hello, What is the equivalent function for : to_char (to_char is Oracle function) in access ? select to_char ( ...) from ... Thanks :)
0
2451
by: woodsc | last post by:
Hi all, I am trying to optimize the queries in my application. Is there a performance difference between (to_char(myDate,format) < myString) and (myDate < to_date(myString, format)). ex. Select * from myTable where (to_char(fieldDate, 'MM/DD/YYY') <= queryDate ) or Select * from myTable where (fieldDate <= to_date(queryDate, 'MM/DD/YYYY') ) assuming fieldDate is a date or timestamp field and queryDate is '01/01/2007', a...
0
9672
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10213
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10000
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9040
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7538
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6780
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5436
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2920
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.