Forum OpenACS Q&A: hello everyone

Collapse
Posted by sivanesan renganaickam on
i'm siva from paris..i'm an electronics engineering student..currently, i'm doing a practical on databases creation in a DVD shop in paris(about which i don't know any single thing)..

i have a table called codes which has the following 8 column:

ind (serial)
code_principal(varchar)
code_secondaire1(varchar) default NULL
code_secondaire2(varchar) default NULL
code_secondaire3(varchar) default NULL
code_secondaire4(varchar) default NULL
code_secondaire5(varchar) default NULL
code_secondaire6(varchar) default NULL

Actually, this table is used to stock in the secondary codes of a product bcoz a product can have more than one barrecode or id....code_principal is a barrecode of the product chosen at first;
i want to create a function with PL/pgsql to clean my table codes bcoz in this table there are alot of reduncancy for exemple in one ligne there's code_secondaire1 = code_secondaire2 and so on. In this example, the function that i wanna create must delete the code_secondaire 2 or more precisely set it as NULL..

can anyone pls help me to do this...thanx alot in advance!

siva.

Collapse
2: Re: hello everyone (response to 1)
Posted by Jade Rubick on
Siva, you might want to post your create table statements.

In general, it's better to have a good data model up front than creating procs to clean up the data later.

Anyway, post what you've tried, and someone here might help.