Oracle Bank Access Money System

Source: Internet
Author: User

Oracle Bank Access Money System

/* Banking system Requirements: 1, create a User Information table (userinfo), a trading information table (deal) 2, User Information tables field: User number, user name, password, balance Transaction information table field: Number, transaction amount, transaction type, user number 3, establish the relationship between two tables  4, all numbers are added in sequence, sequence name: USERINFO_SQ,DEAL_SQ 5, add 4 user information, content customization 6, through Plsql programming to realize the console saving and withdraw money operation, require the console prompt operation mode, such as: 1, take money 2, save, 3 check the balance Note: The access money operation can be performed more than once. */--Creating a user information table, Transaction Information table CREATE TABLE UserInfo (u_id number, user ID u_name varchar2 (20),--User name u_pwd varchar2,--Password U_mone Y number--the balance); Create table Deal (d_id number,----numbered D_money,--Transaction amount D_type varchar2 (), u_id numbers);--Add relationship Alt ER table USERINFO add constraint U_PK primary KEY (u_id) ALTER TABLE DEAL add constraint U_D_FK foreign key (U_ID) refer     Ences USERINFO (u_id); --Add sequence Create sequence Userinfo_sqminvalue 1maxvalue 9999999999999999999999999999start with 1increment by 1cache 20; Create sequence Deal_sqminvalue 1maxvalue 9999999999999999999999999999start with 1increment by 1cache 20;--Add user information Insert Into UserInfo (U_id,u_name,u_pwd,u_money) VALUES (userinfo_sq.nextval, ' Wang Choi ', ' 123 ', +); insert into UserInfo (u_id,u_name,u_pwd,u_money) VALUES (userinfo_sq.nextval, ' Wang Wang ', ' 123 ', 1); insert into UserInfo (U_id,u_name,u_pwd,u_money) VALUES (userinfo_sq.nextval, ' Awang ', ' 123 '), insert into userinfo (U_id,u_name,u_pwd,u_money) VALUES (userinfo_  Sq.nextval, ' Xiao Wang ', ' 123 ', ' n '); Select *from Userinfo;--plsql Programming Declare--Define a variable to hold the user operation input number;  Money number;  Usid number;begin usid:= ' & Current User ID ';  Input:= ' &1 take money, 2 deposit, 3 check balance ';    --Determine the type of operation if Input=1 then money:= ' & withdraw the amount of money ';    Update userinfo set U_money=u_money-money where U_id=usid;    --Save the transaction information to the Trading information table insert into deal (d_id,d_money,d_type,u_id) VALUES (Deal_sq.nextval,money, ' withdrawals ', usid);  End If;    If input=2 then money:= ' & Deposit amount ';    Update userinfo set U_money=u_money+money where U_id=usid;    INSERT into Deal (d_id,d_money,d_type,u_id) VALUES (Deal_sq.nextval,money, ' storage ', usid);  End If;    If input=3 then select U_money to Money from UserInfo where u_id=usid; Dbms_output.put_line (' Current user balance: ' | |    Money);  End If; End

  

Oracle Bank Access Money System

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.