Saturday, September 24, 2011

Electricity billing system using PL/SQL


Objective
Create an electricity billing system, rent rs 20/-
Slab 1 : 1-40 units-0
Slab2: 40-80 units -40
Slab3: >80 -1.40+excess of 80

Program

SQL> create table electricity(cons_id varchar(4) primary key, c_name varchar(20), rent number(2) check (rent=20), unit number(6));
Table created
SQL> insert into electricity values (‘E001’,’deepika’,20,35);
1 row created
SQL> insert into electricity values (‘E002’,’varna’,20,61);
1 row created
SQL> insert into electricity values (‘E003’,’arun’,20,80);
1 row created
SQL> insert into electricity values (‘E004’,’rahul’,20,90);
1 row created

SQL> alter table electricity add (total number (6,2));
Table altered
SQL>declare
2 v_total electricity.total%type;
3 cursor c is select * from electricity;
4 begin
5 for I in c loop
6 if (i.unit <=40) then
7 v_total:=i.rent;
8 elseif (i.unit<=80) then
9 v_total:= i.rent+(i.unit-40)*.40;
10 else
11  v_total:= i.rent+(40*.40)+(i.unit-80)*1.40;
12 end if
13 update electricity set total=v_total,where
14 cons_id = i.cons_id;
15 end loop;
16 end;
17 /
PL/SQL procedure successfully completed
SQL> select* from electricity;
Cons   c_name     rent    unit    total
E001   deepika      20       35       20
E002    varna         20        61       28.4
E003    arun        20          80       36
E004     rahul      20          90        50

17 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging.
    Data Science course in Chennai
    Data science course in bangalore
    Data science course in pune
    Data science online course
    Data Science Interview questions and answers
    Data Science Tutorial

    ReplyDelete
  3. I appreciate your efforts because it conveys the message of what you are trying to say. It's a great skill to make even the person who doesn't know about the subject could able to understand the subject . Your blogs are understandable and also elaborately described. I hope to read more and more interesting articles from your blog. All the best.
    Best Devops Training in pune
    Microsoft azure training in Bangalore
    Power bi training in Chennai

    ReplyDelete
  4. Very nice post here and thanks for it .I always like and such a super contents of these post.Excellent and very cool idea and great content of different kinds of the valuable information's.
    rpa training in bangalore
    best rpa training in bangalore
    rpa training in pune | rpa course in bangalore
    rpa training in chennai

    ReplyDelete
  5. This blog is the general information for the feature. You got a good work for these blog.We have a developing our creative content of this mind.Thank you for this blog. This for very interesting and useful.
    Data Science Training in Indira nagar
    Data Science Training in btm layout
    Data Science Training in Kalyan nagar
    Data Science training in Indira nagar
    Data science training in bangalore

    ReplyDelete
  6. I have to voice my passion for your kindness giving support to those people that should have guidance on this important matter.
    MCSE Training in chennai | mcse training class chennai


    ReplyDelete
  7. Really great information this. I really appreciates your all blog and mostly follows your blog.

    data science with Python Training in Bangalore

    data science Python Course in Bangalore

    ReplyDelete
  8. Electricity Billing System Using Pl/Sql ~ Techietopics >>>>> Download Now

    >>>>> Download Full

    Electricity Billing System Using Pl/Sql ~ Techietopics >>>>> Download LINK

    >>>>> Download Now

    Electricity Billing System Using Pl/Sql ~ Techietopics >>>>> Download Full

    >>>>> Download LINK f5

    ReplyDelete