Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id F3F1996BB2C for ; Thu, 19 Jul 2012 23:35:03 -0300 (ADT) Received: from mail.avineonindia.com ([175.101.1.171] helo=aipl-2s5532s.avineonindia.com) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Ss33T-0003wD-CU for pgsql-admin@postgresql.org; Fri, 20 Jul 2012 02:35:02 +0000 Received: from MAIL.avineonindia.com (Not Verified[10.0.1.9]) by aipl-2s5532s.avineonindia.com with MailMarshal (v6, 8, 3, 9481) id ; Fri, 20 Jul 2012 08:03:53 +0530 X-Footer: YXZpbmVvbmluZGlhLmNvbQ== Received: from aiplina82109cp ([10.0.12.99]) (authenticated user mlanka@avineonindia.com) by MAIL.avineonindia.com for pgsql-admin@postgresql.org; Fri, 20 Jul 2012 08:03:50 +0530 Reply-To: From: "Madhu.Lanka" To: Subject: ERROR: there is no parameter $1 Date: Fri, 20 Jul 2012 08:03:36 +0530 Organization: Avineon India Pvt. Ltd. Message-ID: <000901cd6620$10857220$31905660$@avineonindia.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_000A_01CD664E.2A401F20" X-Mailer: Microsoft Outlook 14.0 Thread-Index: Ac1mH8uZitF8ZVOhQyusjCOqlhDXZA== Content-Language: en-us X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201207/50 X-Sequence-Number: 39767 This is a multipart message in MIME format. ------=_NextPart_000_000A_01CD664E.2A401F20 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi Friends I am creating the function like CREATE OR REPLACE FUNCTION getrowstest3(pname character varying,ppassword character varying) RETURNS SETOF getrows AS $BODY$ declare r getrows; begin for r in EXECUTE 'select u.role_id,u.user_id,p.name,p.creation_date,p.telephone_number,p.email,p.rema rks,p.city,p.state,p.country,p.postal_address,p.company_name,p.department_na me,p.contact_person, p.role_group,p.role_description,p.first_name,p.last_name,p.pincode,p.status, p.department_id,p.designation_id,r.role_name,r.right_edit,r.right_filter,r.r ight_search,r.right_browse, r.right_print,r.right_download,r.right_admin_user,r.right_image_creator,r.ri ght_vector_download,r.right_wps,r.right_queries_filter,r.right_google_map,r. right_user_management, r.right_route_analysis,r.right_legend,r.right_treeview,r.insert,r.update,r.d elete,r.query,r.lock from ksdi.user_roles u,ksdi.principals p,ksdi.roles r where p.PRINCIPAL_ID = u.USER_ID and r.role_id = u.role_id and p.name =$1 and p.password = $2;' loop return next r; end loop; return; end $BODY$ LANGUAGE plpgsql VOLATILE COST 100 ROWS 1000; Where getrows is the type created by me; It is created successfully. I am trying to call the function I pgadmin with the following command select * from getrowstest2('general_user','aipl@123'); I am getting the following error ERROR: there is no parameter $1 LINE 5: r.role_id = u.role_id and p.name= $1 and p.password = $2 ^ QUERY: select u.role_id,u.user_id,p.name,p.creation_date,p.telephone_number,p.email,p.rema rks,p.city,p.state,p.country,p.postal_address,p.company_name,p.department_na me,p.contact_person, p.role_group,p.role_description,p.first_name,p.last_name,p.pincode,p.status, p.department_id,p.designation_id,r.role_name,r.right_edit,r.right_filter,r.r ight_search,r.right_browse, r.right_print,r.right_download,r.right_admin_user,r.right_image_creator,r.ri ght_vector_download,r.right_wps,r.right_queries_filter,r.right_google_map,r. right_user_management, r.right_route_analysis,r.right_legend,r.right_treeview,r.insert,r.update,r.d elete,r.query,r.lock from ksdi.user_roles u,ksdi.principals p,ksdi.roles r where p.PRINCIPAL_ID = u.USER_ID and r.role_id = u.role_id and p.name= $1 and p.password = $2 CONTEXT: PL/pgSQL function "getrowstest2" line 8 at FOR over EXECUTE statement ********** Error ********** ERROR: there is no parameter $1 SQL state: 42P02 Context: PL/pgSQL function "getrowstest2" line 8 at FOR over EXECUTE statement Can anyone please help me to resolve the issue. Thanks in Advance Regards Madhu.Lanka ------=_NextPart_000_000A_01CD664E.2A401F20 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hi = Friends

 

I am creating the function like

 

CREATE OR = REPLACE FUNCTION getrowstest3(pname character varying,ppassword = character varying)

  RETURNS = SETOF getrows AS

$BODY$

declare

r = getrows;

begin

for r in EXECUTE

'select = u.role_id,u.user_id,p.name,p.creation_date,p.telephone_number,p.email,p.r= emarks,p.city,p.state,p.country,p.postal_address,p.company_name,p.departm= ent_name,p.contact_person,

p.role_group,p.role_description,p.first_name,p.last_nam= e,p.pincode,p.status,p.department_id,p.designation_id,r.role_name,r.right= _edit,r.right_filter,r.right_search,r.right_browse,

r.right_print,r.right_download,r.right_admin_user,r.rig= ht_image_creator,r.right_vector_download,r.right_wps,r.right_queries_filt= er,r.right_google_map,r.right_user_management,

r.right_route_analysis,r.right_legend,r.right_treeview,= r.insert,r.update,r.delete,r.query,r.lock from ksdi.user_roles = u,ksdi.principals p,ksdi.roles r where p.PRINCIPAL_ID =3D u.USER_ID and =

r.role_id =3D u.role_id and p.name = =3D$1  and p.password =3D $2;'

loop

return next = r;

end loop;

return;

end

$BODY$

  = LANGUAGE plpgsql VOLATILE

  COST = 100

  ROWS = 1000;

 

Where getrows is the type created by = me;

It is created = successfully.

I am trying to call the = function I pgadmin with the following command

select * from = getrowstest2('general_user','aipl@123');

 

I am = getting the following error

 

ERROR:  = there is no parameter $1

LINE 5: = r.role_id =3D u.role_id and p.name=3D $1 and p.password =3D = $2

         &= nbsp;           &n= bsp;           &nb= sp;        ^

QUERY:  select = u.role_id,u.user_id,p.name,p.creation_date,p.telephone_number,p.email,p.r= emarks,p.city,p.state,p.country,p.postal_address,p.company_name,p.departm= ent_name,p.contact_person,

p.role_group,p.role_description,p.first_name,p.last_nam= e,p.pincode,p.status,p.department_id,p.designation_id,r.role_name,r.right= _edit,r.right_filter,r.right_search,r.right_browse,

r.right_print,r.right_download,r.right_admin_user,r.rig= ht_image_creator,r.right_vector_download,r.right_wps,r.right_queries_filt= er,r.right_google_map,r.right_user_management,

r.right_route_analysis,r.right_legend,r.right_treeview,= r.insert,r.update,r.delete,r.query,r.lock from ksdi.user_roles = u,ksdi.principals p,ksdi.roles r where p.PRINCIPAL_ID =3D u.USER_ID and =

r.role_id =3D u.role_id and = p.name=3D $1 and p.password =3D $2

CONTEXT:  PL/pgSQL function = "getrowstest2" line 8 at FOR over EXECUTE = statement

 

********** Error **********

 

ERROR: there = is no parameter $1

SQL state: = 42P02

Context: PL/pgSQL function = "getrowstest2" line 8 at FOR over EXECUTE = statement

 

Can anyone please help me to resolve the = issue.

 

Thanks in Advance

 

Regards

Madhu.Lanka

 

 

 

------=_NextPart_000_000A_01CD664E.2A401F20--