hi,
I need to send some values to a subroutine where i use insert query.
suppose say my scalar is as follows:
my ($name,$number, $address) etc and i get the values into those scalars dynamically by some other process. When i send these values to the subroutine containing an insert query, there for the columns containing
varchar i need to have ' some value' for int no quotes are requried. For
example if we take $name, the Name column in the database is varchar.
So value inside $name need to have ' ' (A single quote). For number it is not the case . If i do assign the values as $name="'Pavan'" (here i am including single quotes inside double quotes). But when the data comes from some other source , it comes as $name="pavan" and when i pass this value to a subroutine,
to the query , the query becomes something like
insert into employee (Empno,Ename,Ad dress) values (1,pavan,add);
It need to be (1,'pavan','add '); So, please tell me how to insert single quotes.
Thanks & Regards,
Pavan
I need to send some values to a subroutine where i use insert query.
suppose say my scalar is as follows:
my ($name,$number, $address) etc and i get the values into those scalars dynamically by some other process. When i send these values to the subroutine containing an insert query, there for the columns containing
varchar i need to have ' some value' for int no quotes are requried. For
example if we take $name, the Name column in the database is varchar.
So value inside $name need to have ' ' (A single quote). For number it is not the case . If i do assign the values as $name="'Pavan'" (here i am including single quotes inside double quotes). But when the data comes from some other source , it comes as $name="pavan" and when i pass this value to a subroutine,
to the query , the query becomes something like
insert into employee (Empno,Ename,Ad dress) values (1,pavan,add);
It need to be (1,'pavan','add '); So, please tell me how to insert single quotes.
Thanks & Regards,
Pavan
Comment