Hey guys,

i got a question that bothers me quite a while,
been looking everywhere but found no answer

My idea is to automate this procedure for better performance...

Can anybody in here tell me if its possible to auto create
a 4 digit randomly code 1st digit alpha 2nd -4th numeric
that gets looked up in the db if its there new code is generated
if its not give the code back to my php proggy?
I would like to do it in PostGreSQl with a stored procedure

Any Help would be appreciated, since iam totally lost...
Thx in advance

Search Discussions

  • Robby Russell at Aug 9, 2004 at 3:31 pm

    On Mon, 2004-08-09 at 02:13, Marcel Boscher wrote:
    Hey guys,

    i got a question that bothers me quite a while,
    been looking everywhere but found no answer

    My idea is to automate this procedure for better performance...

    Can anybody in here tell me if its possible to auto create
    a 4 digit randomly code 1st digit alpha 2nd -4th numeric
    that gets looked up in the db if its there new code is generated
    if its not give the code back to my php proggy?
    I would like to do it in PostGreSQl with a stored procedure

    Any Help would be appreciated, since iam totally lost...
    Thx in advance
    So, you want to create something like:
    n312
    b943
    z338

    Correct?

    You would probably want to play around with the server side functions in
    plpgsql, or even look into something like plperl, plphp, etc. Start off
    with getting a function to return you a 4 character string, then when
    that appears to be working, look into the plpgsql syntax to figure out
    how to check that it's the only one like that otherwise, rerun the
    function and return a different string.

    Hope that helps get you started in the right direction,

    -Robby


    --
    /***************************************
    * Robby Russell | Owner.Developer.Geek
    * PLANET ARGON | www.planetargon.com
    * Portland, OR | robby@planetargon.com
    * 503.351.4730 | blog.planetargon.com
    * PHP/PostgreSQL Hosting & Development
    ****************************************/

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppgsql-general @
categoriespostgresql
postedAug 9, '04 at 9:10a
activeAug 9, '04 at 3:31p
posts2
users2
websitepostgresql.org
irc#postgresql

2 users in discussion

Robby Russell: 1 post Marcel Boscher: 1 post

People

Translate

site design / logo © 2022 Grokbase