Jun 08, 2021 2:03 pm
How to write a PLSQL Program to display customer account details for the given customer name?
1 Reply
Jun 09, 2021 5:21 am
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.