uinique identifier

Поиск
Список
Период
Сортировка
От ||//::..-cwhisperer-..:://||
Тема uinique identifier
Дата
Msg-id 9069492264.20020526125335@vo.lu
обсуждение исходный текст
Ответы Re: uinique identifier  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Список pgsql-sql
hi,

I want to create an unique identifier for all the tables in my db.

as paramater I pass the length of the identifier and the table name:

here my function

DROP FUNCTION ui_alz_table (int4,varchar);

CREATE FUNCTION ui_alz_table (int4,varchar) RETURNS varchar AS '

DECLARE
iLoop int4;
result varchar;
nr int4;
query_string varchar;
       BEGIN        result := '''';       nr := 1;              IF ($1>0) AND ($1 < 255) THEN           WHILE nr > 0
LOOP             FOR iLoop in 1 .. $1 LOOP                result := result || chr(int4(random()*25)+65);
ENDLOOP;              query_string := ''Select * from ''|| $2 || '' where id = '' || result;              EXECUTE
query_string;             IF NOT FOUND THEN                nr := 0;              END IF;           END LOOP;
RETURNresult;       END IF;       END;  
 
' LANGUAGE 'plpgsql';

in the for loop I create the unique identifier and  whith the
query_string I check whetherit exists or not.

but I get an error 'Attribute xxxx not found' and I don't know what to to with it.

thx for your help
 

-- 
Best regards,||//::..-cwhisperer-..:://||                          mailto:cwhisperer@vo.lu



В списке pgsql-sql по дате отправления:

Предыдущее
От: "Rajesh Kumar Mallah."
Дата:
Сообщение: Re: Functions with dynamic queries
Следующее
От: Stephan Szabo
Дата:
Сообщение: Re: uinique identifier