Forum

Write a PLSQL Progr...
 
Notifications
Clear all

Write a PLSQL Program to display customer account details for the given customer name


Sam EDU
Posts: 4
Topic starter
(@testuser)
New Member
Joined: 1 month ago

How to write a PLSQL Program to display customer account details for the given customer name?

1 Reply
KV Kumar
Posts: 27
Admin
(@vinodkrsetty)
Member
Joined: 2 years ago

You may try the below PLSQL procedure to display customer account details for the given customer name.

declare
vcname  varchar2(20);
vactno  number(12);
vacttype  varchar2(10);
vopendate date;
vactbal  number;
vccode  varchar2(10);
begin
vcname:='&vcname';
select actno,act_type,act_open_date,act_bal,cust_code 
	into 
       vactno,vacttype,vopendate,vactbal,vccode
       from cust_act_dtls
       where cno =(select cno from cust_dtls where cname=vcname);
       
dbms_output.put_line('Account details of  '||upper(vcname));
dbms_output.put_line('*************************************');
dbms_output.put_line('Account Number='||vactno);
dbms_output.put_line('Account Type='||vacttype);
dbms_output.put_line('Account Open Date='||vopendate);
dbms_output.put_line('Account Balance='||vactbal);
dbms_output.put_line('Customer Code='||vccode);
end;

Note:

Generally, we need to declare a variable with column data
type otherwise we will get compatibility issues.

To store a complete record into a variable we need to declare a
variable as TABLE BASED RECORD type variable.

Reply
Share: