Welcome To JE Blog

Posts

PL/SQL Example: Calculate Your Age

Published on 10-AUG-2016 by USER5

The following will beshown examples of PL/SQL to calculate a person's age. Person's age can be determined from the difference between the current date with the date of birth.   DECLARE         tlahir DATE;         umur NUMBER; BEGIN         --ENter your birth data with DD-MM-YYYY (ex: 17-02-1990)         tlahir := TO_DATE('&indate', 'DD-MM-YYYY');         umur := FLOOR((SYSDATE - tlahir)/365);         DBMS_OUTPUT.PUT_LINE ('Your age is '||umur||' years old'); END; /   Above PL/SQL block have 2 variables, tlahir with DATE data type and age with NUMBER data type.Tlahir variable will receive input from a keyboard entry date of birth in the format DD-MM-YYYY.Umur variable will make the process of calculating the difference between SYSDATE (current date)with tlahir (date of birth) were divided by 365 (days in a year). To generate integers by rounding downis used FLOOR function. If the input is "17-02-1990" then the output is "Your age is 23 years old".

No Comment(s)

PL/SQL Example: Calculating Parking Fee

Published on 10-AUG-2016 by USER5

At a shopping area usually has a parking facility equipped with automated parking system. Automatic calculation is done by a parking program. Parking fee is determined by the time of the vehicle was in the mall parking area. Calculation is obtained from the difference from output and input times that multiplies by the hourly rate. The following PL / SQL block to perform automatic parking fee calculation:   DECLARE  jamin TIMESTAMP;  jamout TIMESTAMP;  jam NUMBER;  menit NUMBER;  waktu VARCHAR2(32);  tarif NUMBER;  biaya NUMBER; BEGIN  tarif := 1000;  jamin := TO_TIMESTAMP('&time_input','HH24:MI');--ex 08:15  jamout := TO_TIMESTAMP('&time_output','HH24:MI');--ex 13:45  jam := EXTRACT(HOUR FROM jamout)-EXTRACT(HOUR FROM jamin);  menit := EXTRACT(MINUTE FROM jamout)-EXTRACT(MINUTE FROM jamin);  waktu := jam||' jam '||menit||' menit ';  IF

No Comment(s)

Step By Step How To Integrate Oracle APEX 5 with Apache Tomcat 7 + APEX Listener 2.0.10

Published on 07-AUG-2016 by USER5

Here are the steps how to integrate Oracle APEX 5 with Apache Tomcat 7 + APEX Listener 2.0.10 : 1. run command prompt (cmd) then connect to oracle database as sysdba create tablespace apex  logging  datafile 'E:\oraclexe\oradata\apex.dbf' --> set as your wish  size 512m  autoextend on  next 64m maxsize 10G  extent management local; ...

No Comment(s)

Search

 

--

Visitors Counter

Flag Counter