Advertisement

03.12.2008 at 08:20AM PDT, ID: 23235361 | Points: 150
[x]
Attachment Details

How do I write Oracle SQL code to perform a simple math calculation??

Tags: Oracle, PL/SQL, SQL
Please refer to the file attachment below.  

All the code and screenshots are in the document....

Your help is greatly appreciated!!!!

Thanks Very Very Very Very Much!!!!!
Attachments:
 
Screenshots & SQL Code - LOOOOK HERE!!
 
Start your free trial to view this solution
Question Stats
Zone: Database
Question Asked By: buffygal
Question Asked On: 03.12.2008
Participating Experts: 1
Points: 150
Views: 0
Translate:
Loading Advertisement...
03.12.2008 at 08:32AM PDT, ID: 21107090

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.12.2008 at 09:12AM PDT, ID: 21107534

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.12.2008 at 09:24AM PDT, ID: 21107660

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.12.2008 at 09:49AM PDT, ID: 21107990

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.12.2008 at 10:35AM PDT, ID: 21108584

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.13.2008 at 07:00AM PDT, ID: 21116263

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.15.2008 at 02:16AM PDT, ID: 21131928

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Handhelds / PDAs
  • Displays / Monitors
  • Components
  • Networking Hardware
  • Peripherals
  • Laptops/Notebooks
  • Storage
  • Servers
  • Desktops
  • New Users
  • Misc
  • Apple
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMWare
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMWare
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Community Advisor
  • Lounge
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • Community Advisor
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
03.12.2008 at 08:32AM PDT, ID: 21107090
hi, try this
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
with criteria as (select to_date('03/14/08', 'mm/dd/rr')  as start_date,
                         4 as periods,
                         'Week' as period,
                         200 per_period from dual),
periods as (select 'Week' period, 7 days, 0 months from dual
  union all select 'BiWeek', 14, 0 from dual
  union all select 'Month', 0, 1 from dual
  union all select 'ByMonth', 0, 2 from dual
  union all select 'Quarter', 0, 3 from dual
  union all select 'Year', 0 , 12 from dual
),
t1 as (
select add_months(start_date,months*(level-1))+days*(level-1) start_date,
       per_period,
       c.period||' '||level||' of '||c.periods period,
       per_period * 0.2 Federal_Taxes,
       per_period * 0.0765 FICA_Taxes,
       per_period * 0.7235 Net_Amount
  from criteria c join periods p on c.period = p.period
 connect by level <= periods)
select case grouping(start_date)
            when 1 then 'Total'
            else to_char(start_date)
       end start_date, 
       sum(per_period) per_period, 
       period
from t1
group by rollup ((start_date, period))
Open in New Window
 
03.12.2008 at 09:12AM PDT, ID: 21107534
Hello ee_rlee,

Thank you for such a fast reply!!  

A couple of questions came up when I ran it:

(1) The additional fields of Federal_Taxes, FICA_Taxes, and Net_Amount did not come up when I ran the query

(2)  Net_Amount should be Per_Period minus Federal_Taxes and FICA_TAXES.  Looks like it might be multiplying instead.

Thanks VERY VERY VERY MUCH!!!





 
03.12.2008 at 09:24AM PDT, ID: 21107660
(1) how are you viewing the result of this query?

(2) to get  per_period - Federal_Taxes - FICA_Taxes, you must do it like this

per_period - per_period * 0.2 -  per_period * 0.0765

which is also the same as this one

per_period * 0.7235

 
03.12.2008 at 09:49AM PDT, ID: 21107990
I'm just viewing it in PL/SQL developer.  I'm real new at this.  

Please see the output in the file attachment.......

Thanks Very Much!!!
 
Screenshot of the Query Results
 
 
03.12.2008 at 10:35AM PDT, ID: 21108584
can you try this?
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
with criteria as (select to_date('03/14/08', 'mm/dd/rr')  as start_date,
                         4 as periods,
                         'Week' as period,
                         200 per_period from dual),
periods as (select 'Week' period, 7 days, 0 months from dual
  union all select 'BiWeek', 14, 0 from dual
  union all select 'Month', 0, 1 from dual
  union all select 'ByMonth', 0, 2 from dual
  union all select 'Quarter', 0, 3 from dual
  union all select 'Year', 0 , 12 from dual
),
t1 as (
select per_period * 0.2 Federal_Taxes,
       add_months(start_date,months*(level-1))+days*(level-1) start_date,
       per_period,
       c.period||' '||level||' of '||c.periods period,
       per_period * 0.0765 FICA_Taxes,
       per_period * 0.7235 Net_Amount
  from criteria c join periods p on c.period = p.period
 connect by level <= periods)
select case grouping(start_date)
            when 1 then 'Total'
            else to_char(start_date)
       end start_date, 
       sum(per_period) per_period, 
       period
from t1
group by rollup ((start_date, period))
Open in New Window
 
03.13.2008 at 07:00AM PDT, ID: 21116263
Hello ee_rlee,

It does not run the way it should over here.......

Please look at the attachment to see how it looks when it runs.....

Thanks Very Much!!!!!!!!!!
 
Please look at this!!!! Thanks Very Much
 
 
03.15.2008 at 02:16AM PDT, ID: 21131928
Sorry about the late reply..
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
with criteria as (select to_date('03/14/08', 'mm/dd/rr')  as start_date,
                         4 as periods,
                         'Week' as period,
                         200 per_period from dual),
periods as (select 'Week' period, 7 days, 0 months from dual
  union all select 'BiWeek', 14, 0 from dual
  union all select 'Month', 0, 1 from dual
  union all select 'ByMonth', 0, 2 from dual
  union all select 'Quarter', 0, 3 from dual
  union all select 'Year', 0 , 12 from dual
),
t1 as (
select add_months(start_date,months*(level-1))+days*(level-1) start_date,
       per_period,
       c.period||' '||level||' of '||c.periods period,
  from criteria c join periods p on c.period = p.period
 connect by level <= periods)
select case grouping(start_date)
            when 1 then 'Total'
            else to_char(start_date)
       end start_date, 
       sum(per_period) per_period, 
       period,
       sum(per_period) * 0.2 Federal_Taxes,
       sum(per_period) * 0.0765 FICA_Taxes,
       sum(per_period) * 0.7235 Net_Amount
from t1
group by rollup ((start_date, period))
Open in New Window
 
 
20080236-EE-VQP-29 / EE_QW_2_20070628