dbTalk Databases Forums  

Syntax Error

comp.databases.postgresql.novice comp.databases.postgresql.novice


Discuss Syntax Error in the comp.databases.postgresql.novice forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Marcel Boscher
 
Posts: n/a

Default Syntax Error - 08-10-2004 , 07:44 AM






Hey there,

ERROR: function round(double precision, integer, integer) does not exist
Any suggestions

Purpose is to generate a 4 digit errorcode 1st letter alpha - rest numeric

my source code:

DECLARE
chars nchar(26);
charpos INTEGER;
character nchar(4);
nentries INTEGER;
key INTEGER;

BEGIN
chars := 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
charpos := Round((random() * (length(chars)-1)), 0, 0);
character := SubString(chars, charpos, 1) ;

nentries := 1;
WHILE (nentries > 0) LOOP
key := trunc(random() * 10000);

SELECT eCode = character + key

SELECT
INTO nentries
count(*)
FROM se_errorcode
WHERE se_errorcode.entry = eCode;
END LOOP;

INSERT
INTO se_errorcode (entry)
VALUES (eCode);

RETURN(eCode);
END;

Thx in advance
Marcel

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo (AT) postgresql (DOT) org)


Reply With Quote
  #2  
Old   
Oliver Elphick
 
Posts: n/a

Default Re: Syntax Error - 08-10-2004 , 08:12 AM






On Tue, 2004-08-10 at 13:44, Marcel Boscher wrote:
Quote:
Hey there,

ERROR: function round(double precision, integer, integer) does not exist
Any suggestions
No such function is defined.

According to the manual there are:

round(double precision)
round(numeric)
round(numeric, integer)

The second parameter of the last one specifies the number of decimal
places.

--
Oliver Elphick olly (AT) lfix (DOT) co.uk
Isle of Wight http://www.lfix.co.uk/oliver
GPG: 1024D/A54310EA 92C8 39E7 280E 3631 3F0E 1EC0 5664 7A2F A543 10EA
========================================
"Be still before the LORD and wait patiently for him;
do not fret when men succeed in their ways, when they
carry out their wicked schemes."
Psalms 37:7


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.