|
|
Sponsor |
Help with creating function: msg#00141db.postgresql.novice
Greetings, Could someone please help with creating the following function: As a psql command it would be set var4 = upper(rpad(var1, 5, '-')) || lower(rpad(var2, 5, '-')) || lpad(var3, 5, '0')) All variables are text. I am attempting to assign a value to var4 that concatenates var 1, 2 & 3. As Var 1 to 3 may collectively exist on several tables -- i.e a.1, a.2, a.3 vs b.1, b.2, and b.3 -- but all results for var4 will be inserted into yet another table "var4". Example: Table "Client" contains ID SURNAME GIVEN Table "author" contains ID SURNAME GIVEN Table "nick" would contain NICK (var4) table of origin SURNAME I have attempted to create this procedure as a function: CREATE FUNCTION nick_sur (text, text, text) RETURNS TEXT as ... balance of above sql stmt. both with and without the 'set =' prefix, using both 'text' and '$1', '$2', and '$3' in place of 'var(x)' and combinations of the preceding, also with the language (sql) quoted and not qutoed. I've searched the documentation, '\h create function' and the postgres site, but can't seem to get the right syntax for creating this function. Many thanks, C-Cose Masters ---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to majordomo@xxxxxxxxxxxxxx
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Can't get pg_hba.conf to work, Doug Silver |
|---|---|
| Next by Date: | Re: Date Question, Josh Berkus |
| Previous by Thread: | Date Question, Sharon Cowling |
| Next by Thread: | Re: Help with creating function, Henshall, Stuart - WCP |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |
Home | sitemap
| advertise | OSDir is
an inevitable website.
|