View Full Version : help with hex print
marbo
06-27-2003, 02:30 AM
Hi all,
part of my procedure should generate random number, convert it to hex nad
put it into table and text file
I've tried to do it in two ways. (sample of code listed below). Both works
if I try to select from dual table, but when I've put them into Oracle Forms
my problems hve started:
1) i := rawtohex(abs(dbms_random.random()));
do not waht to even compile
2) i := to_char(abs(dbms_random.random()),'FM0XXXXXXX');
seem to work but in output text file generated via text_io procedures
instead of hex number I've got # signs
Does anybody any idea where is my mistake?
marbo
----
sample of code. It will not work, becuse I had to cut it (was much to long)
byt maybe it will give you idea . . .
i varchar2(500);
BEGIN
TEXT_IO.IS_OPEN(file_id)
dbms_random.initialize(19254);
-- 1:
-- i := rawtohex(abs(dbms_random.random()));
-- 2:
--i := to_char(abs(dbms_random.random()),'FM0XXXXXXX');
-- I try to pirnt i in 1 or 2 way - both do not work
TEXT_IO.Put_Line(file_id, i);
dbms_random.terminate;
TEXT_IO.FCLOSE(file_id);
END;
Sybrand Bakker
06-27-2003, 09:36 AM
On Fri, 27 Jun 2003 12:30:10 +0200, "marbo" <marbo@tpi.pl> wrote:
Does anybody any idea where is my mistake?
1 - Not posting any specific error messages
2 - Posting something with nothing to work on, forcing other people
to reproduce the problem.
Sybrand Bakker, Senior Oracle DBA
To reply remove -verwijderdit from my e-mail address
marbo wrote: Hi all, part of my procedure should generate random number, convert it to hex nad put it into table and text file I've tried to do it in two ways. (sample of code listed below). Both works if I try to select from dual table, but when I've put them into Oracle Forms my problems hve started: 1) i := rawtohex(abs(dbms_random.random())); do not waht to even compile 2) i := to_char(abs(dbms_random.random()),'FM0XXXXXXX'); seem to work but in output text file generated via text_io procedures instead of hex number I've got # signs Does anybody any idea where is my mistake? marbo ---- sample of code. It will not work, becuse I had to cut it (was much to long) byt maybe it will give you idea . . . i varchar2(500); BEGIN TEXT_IO.IS_OPEN(file_id) dbms_random.initialize(19254); -- 1: -- i := rawtohex(abs(dbms_random.random())); -- 2: --i := to_char(abs(dbms_random.random()),'FM0XXXXXXX'); -- I try to pirnt i in 1 or 2 way - both do not work TEXT_IO.Put_Line(file_id, i); dbms_random.terminate; TEXT_IO.FCLOSE(file_id); END;
Worked just fine for me.
MyLounge.com Site Map
Forum:
Cars,
Cell Phone,
Database,
Games,
Home Improvement,
IT,
Music,
School,
Sports,
Web Design,
Web Server,
Weight Loss
The MyLounge.com forum is intended for informational use only and should not
be relied upon and is not a substitute for any advice. The information contained
on MyLounge.com are opinions and suggestions of members and is not a representation
of the opinions of MyLounge.com. MyLounge.com does not warrant or vouch for
the accuracy, completeness or usefulness of any postings or the qualifications
of any person responding. Please consult a expert or seek the services of an
attorney in your area for more accuracy on your specific situation. Please note
that our forums also serve as mirrors to Usenet newsgroups. Many posts you see
on our forums are made by newsgroup users who may not be members of MyLounge.com
Term of Service
vBulletin v3.0.7, Copyright ©2000-2008, Jelsoft Enterprises Ltd.