Forum

Write a PLSQL Progr...
 
Share:
Notifications
Clear all

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


Posts: 4
Topic starter
(@testuser)
New Member
Joined: 3 years ago

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

1 Reply
Posts: 27
Admin
(@vinodkrsetty)
Eminent Member
Joined: 5 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

Self Learning Video Tutorials - Software Course

Leave a reply

Author Name

Author Email

Title *

 
Preview 0 Revisions Saved
Share: