Inserting a bitarray value through storedprocedure
От | Deepa K |
---|---|
Тема | Inserting a bitarray value through storedprocedure |
Дата | |
Msg-id | 3E7AFB64.F7B07671@midascomm.com обсуждение исходный текст |
Список | pgsql-general |
Hi all, I need to insert a bit array value into a table through storedprocedure. The bit array value need to be formed dyanamically, since its very big value. I tried in the following manner. create function testProc(text,text,integer) returns integer as ' DECLARE verNum alias for $1; profileName alias for $2; appNum alias for $3; count int := 0; privilegeRow diuflatnumprivileges%rowtype; flatNumArr text; APPLICATIONS_INSERTED int2 := 0; begin select into privilegeRow * from diuflatnumprivileges where diuprofilename = profileName and diuversionnumber = verNum; if not found then flatNumArr = ''\\\'{''; while count < 4000 loop if count != 3999 then flatNumArr = flatNumArr||''0,''; else flatNumArr = flatNumArr||''0''; end if; count := count + 1; end loop; flatNumArr = flatNumArr||''}\\\'''; insert into diuflatnumprivileges values (verNum, profileName,flatNumArr,flatNumArr); end if; return APPLICATIONS_INSERTED; end; ' language 'plpgsql'; When I try to select the above storedprocedure, I am getting the following error testdb=# select testproc('ver1','profile1',1); ERROR: Attribute 'diureadprivileges' is of type '_bit' but expression is of type 'text' You will need to rewrite or cast the expression How to insert a dyanamically created value as bit array through stored procedure. And also when I try to print the value (flatNumArr) using raise notice, the backend closed abrubtly. What could be the possible reason for this. Can any one help me. Very urgent. regards, Deepa K.
В списке pgsql-general по дате отправления: