473,657 Members | 2,690 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Stored Procedure - Iam totally lost!

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

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

Nov 23 '05 #1
1 1502
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 | ro***@planetarg on.com
* 503.351.4730 | blog.planetargo n.com
* PHP/PostgreSQL Hosting & Development
*************** *************** **********/

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 23 '05 #2

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

Similar topics

1
1539
by: Evgeny Gopengauz | last post by:
Hi! I need to write a t-sql-script like this: (case-1) IF {stored procedure SP is not exists} BEGIN CREATE PROCEDURE SP AS BEGIN //dummy body END
7
3209
by: JIM.H. | last post by:
Hello, Is there any difference to between SLQ string in the code and call execute query and call a stored procedure and execute the query that way concerning speed, effectiveness, reliability, …? Thanks, Jim.
45
3390
by: John | last post by:
Hi When developing vb.bet winform apps bound to sql server datasource, is it preferable to use SELECTs or stored procedure to read and write data from/to SQL Server? Why? Thanks Regards
12
2292
by: Jason Huang | last post by:
Hi, In my C# Windows Form application project, I have done all queries on my codes. Now I wanna try using the Stored Procedure. But I am not clear about why using the stored procedure. Would some one give me some advice? Thanks for help.
0
19272
by: IamtheEvster | last post by:
Hi All, I am currently using PHP 5 and MySQL 5, both on Fedora Core 5. I am unable to call a MySQL stored procedure that returns output parameters using mysql, mysqli, or PDO. I'm having a hell of a time with it... The following comes from phpinfo(): PHP Version: 5.1.2 mysql Client API version: 5.0.18 mysqli Client API version: 5.0.18
9
2454
by: Frawls | last post by:
Hi I Am am having problems with a stored Procedure that i wrote. Basically whats happening is that the Stored procedure Runs fine when i EXECUTE it in SQL Query analyzer. But when i debug through the application in Visual Studio .NET 2003 the application an exception when it executes the query.
9
4808
by: Problematic coder | last post by:
The intention is to call a stored proceedure which sets flags in the database, this requires no parameters and the page does not need an output from the stored proceedure, though is this is necessary I could change that. Here is the code I am using: Dim objcom2 = New Data.OracleClient.OracleCommand With objcom2 .Connection = objcnn
2
5297
by: trickyidiot | last post by:
I don't even know if this is possible - I'm still fairly new to stored procedures. I have 4 tables I need to compile data from: saved_searches saved_homes printed_homes member_info saved_searches, saved_homes and printed_homes each track the date they were created.
5
1982
by: william.david.anderson | last post by:
Hi there, I have a newbie stored procedures performance question that I'm hoping someone can answer. It seems like one of the benefits of using SQL stored procedures is that they can reduce the network traffic between the client and server, resulting in a performance gain. I'm wondering, though, if there's a performance penalty because it could be harder to reuse prepared statements with them.
0
8306
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8825
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8503
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6164
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
5632
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
4152
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...
0
4304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
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
2
1955
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.