Hi
pgsql-admin-owner@xxxxxxxxxxxxxx wrote on 20/07/2012 03:33:36:
> From: "Madhu.Lanka" <mlanka@xxxxxxxxxxxxxxxx>
> To: <pgsql-admin@xxxxxxxxxxxxxx>,
> Date: 20/07/2012 06:37
> Subject: ERROR: there is no parameter $1
> Sent by: pgsql-admin-owner@xxxxxxxxxxxxxx
>
> 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.remarks,p.city,p.state,p.country,p.postal_address,p.company_name,p.department_name,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.right_search,r.right_browse,
> r.right_print,r.right_download,r.right_admin_user,r.right_image_creator,r.right_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.delete,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.remarks,p.city,p.state,p.country,p.postal_address,p.company_name,p.department_name,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.right_search,r.right_browse,
> r.right_print,r.right_download,r.right_admin_user,r.right_image_creator,r.right_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.delete,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
You have named the parametes in the arguments list:
getrowstest3(pname character varying,ppassword character varying)
try the sql with:
p.name =pname and p.password = ppassword;
Cheers
Martin=============================================
Romax Technology Limited
Rutherford House
Nottingham Science & Technology Park
Nottingham,
NG7 2PZ
England
Telephone numbers:
+44 (0)115 951 88 00 (main)
For other office locations see:
http://www.romaxtech.com/Contact
=================================
===============
E-mail: info@xxxxxxxxxxxxx
Website: www.romaxtech.com
=================================
================
Confidentiality Statement
This transmission is for the addressee only and contains information that is confidential and privileged.
Unless you are the named addressee, or authorised to receive it on behalf of the addressee
you may not copy or use it, or disclose it to anyone else.
If you have received this transmission in error please delete from your system and contact the sender. Thank you for your cooperation.
=================================================