mysql - fetch data from table -


i have following table in database

create table `sms_pool` (     `id` int(11) not null auto_increment,     `ag_id` varchar(20) not null,     `sms_to` varchar(15) not null,     `template_name` varchar(100) not null,     `contents` varchar(500) not null,     `bulk_flag` varchar(1) not null,     `file_name` varchar(100) null default null,     `send_flag` varchar(1) not null,     `creation_date` datetime not null default current_timestamp,     `created_by` varchar(20) not null,     `modification_date` datetime null default null,     `modified_by` varchar(20) null default null,     `processing_msg` varchar(2000) null default null,     primary key (`id`),  ); 

i wish write procedure/function takes 'id' input.

if 'id' present in table should return corresponding row,

if 'id' = null should return of rows database.

note : if 'id' not present in table should return of rows.

how should this? appreciated. thank in advance. :d

you mean

select * sms_pool :id = id or :id null; 

Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -