SQL & PL/SQL :: Monthly Running Total With Opening Balance

May 9, 2012

I want to generate the gapless montly running balance for the whole year.Data in the table "A" is as below.

code Date amount remarks
0101 30-SEP-10 1000 Opening
0101 01-OCT-10 1500
0102 25-OCT-10 500
0102 10-DEC-10 750
0101 26-JAN-11 450
0102 03-MAR-11 3000
0101 30-SEP-11 6000

Required output is
Code Date amount Balance
0101 31-OCT-10 1500 2500
0101 30-NOV-10 0 2500
0101 31-DEC-10 0 2500
0101 31-JAN-11 450 2950
-- -- -- continue
0101 30-SEP-11 6000 8950

Same output for code 0102. I have taken only 02 code for excample only. There are about 250 code in table.

View 14 Replies


ADVERTISEMENT

SQL & PL/SQL :: Add Aging Columns To Derive Total Balance Overdue?

Nov 26, 2012

I am doing a report to show current balance, aging (30-60), (60-90), (90-120) and 120+ and a combination of all of these should be the total balance overdue.

If i use a formula cclumn in the report builder, how should i write this query to calculate the total?

View 1 Replies View Related

SQL & PL/SQL :: Cumulative Running Balance By Condition?

Mar 24, 2013

Is there a way to find running balance for accounts, suppose i have two tables.one for transaction and one summary of balance.

i want to have the closing balance based on transactions subtracted or added based on credit and debit for example.it will add to the running total if its debit and subtract if its credit and final output is the balance.

create table acnt_trans ( acnt_code varchar2(12),trans_date date,debit_amt number,credit_amt number);
insert into acnt_trans values ('1001','02-FEB-2013',200,0);
insert into acnt_trans values ('1001','03-FEB-2013',0,100);
insert into acnt_trans values ('1001','04-FEB-2013',50,0);

[code]....

--I want the output as below.if i run the report as of '04-feb-2013'

trans_date , acnt_code , debit_amt,credit_amt , balance
02-feb-2013 1001 200 0 3200
03-feb-2013 1001 0 100 3100
04-feb-2013 1001 50 0 3150 -- this is the closing balance.

View 4 Replies View Related

SQL & PL/SQL :: Running Total SUM (Amt) Over?

Apr 21, 2012

My example: I'm given an Allowance throughout the week. It happens to be 10 dollars but it can vary from day to day.I can create a running total with SUM(Amt) Over etc...This is the CUMUL column in the example below.

On certain days I've spent different percentages of the allowance. (The SPENT Column which is a field in the database)I can't manage to create the AMTLEFT column in the example below.The AmtLeft column seems to be a kind of running total that 'refers to itself' so this is where I'm stumped.

Week,Day,Amt,Cumul,Spent,AmtLeft
1,Mon,10,10,0%,10
1,Tue,10,20,50%,10
1,Wed,10,30,0%,20
1,Thu,10,40,0%,30

[code]...

My imaginary SQL would look something like at this point (if I have it right):

SELECT Week, Day, Amt, Sum(Amt) Over (Partition By Week, Order By Day) AS Cumul, Spent FROM AllowancesTable

How to get the last column AmtLeft?

View 14 Replies View Related

PL/SQL :: Running Total For Each Day - Nulls?

Oct 2, 2013

I'm on 11.2.0.3.  I want to write a query to get calculate a running total of incidents per day - this query will be used for an APEX line chart.Sample table and data:

create table sales (
  id number primary key,
  time_of_sale date,
  item varchar2(20));
insert into sales values (1, to_date('02-JAN-2013','DD-MON-YYYY'), 'book'); ....

View 6 Replies View Related

PL/SQL :: Running Total For Duplicate Rows

Dec 19, 2012

I am trying to write an sql which shows the running total for records which has duplicate.

sample rows:

col1 col2 col3
1      A    2
1      A    2
1      A    2
1      B    3
1      B    3
1      C    5
1      D    2
1      D    2o

p required:

col1 col2 col3  cumulative_tot
1      A    2       2
1      A    2       2
1      A    2       2
1      B    3       5
1      B    3       5
1      C    5       10
1      D    2       12
1      D    2       12

View 3 Replies View Related

SQL & PL/SQL :: Showing Monthly Data

Mar 6, 2013

I am having the query

SELECT JOB,
decode(to_char(hiredate,'YY'),80,to_char(hiredate,'MON'),NULL) "80",
decode(to_char(hiredate,'YY'),81,to_char(hiredate,'MON'),NULL) "81",
decode(to_char(hiredate,'YY'),82,to_char(hiredate,'MON'),NULL) "82",
decode(to_char(hiredate,'YY'),83,to_char(hiredate,'MON'),NULL) "83",
count(*) total
FROM emp
WHERE JOB='CLERK'
GROUP BY JOB,
hiredate;

I want result as follows

job 80 81 82 83 TOTAL
CLERK DEC DEC 2
CLERK JAN JAN 2

That means if 80,81,82,83 if having some common month then it should show side by side.

View 20 Replies View Related

SQL & PL/SQL :: Write Query To Show Monthly Salary?

Jul 12, 2012

i have table structure (emp_no, emp_sal,emp_startwork)

i want query to show the monthly salary such as jan month salary Feb month salary

View 2 Replies View Related

SQL & PL/SQL :: Create Procedure Run For Both Monthly As Well As Yearly Report

Aug 3, 2010

I want to create procedure who should run for both montly as well as yearly report for monthly report i will pass Year and Month as argument for year i will pass Year only

for annual report i a counting all the user, new entry for item, new enty for customer, new enty for admin for montly report i am counting new item, new group.

View 16 Replies View Related

SQL & PL/SQL :: Balance Of Stock Amount

Nov 29, 2012

i want to get balanced amount based on max(suid ).

my query is

create or replace procedure prc_stk_upd_pur(v_comp_suid in i_purchase_h.pih_company_suid%type,
v_area_suid in i_purchase_h.pih_area_suid%type,
v_invoice_dt in i_purchase_h.pih_invoice_date%type,
v_pih_suid in i_purchase_h.pih_suid%type,
v_type in i_purchase_h.pih_type%type) is
[code]......

my output is
SEFF_SUIDSEFF_INV_DATESEFF_LOT_SUIDSEFF_LOC_SUIDSEFF_TRAN_SUIDSEFF_TRAN_TYPESEFF_COMP_SUIDSEFF_AREA_SUIDSEFF_STOCK_INSEFF_STOCK_OUTSEFF_CURRENT_STOCKCREATE_USERCREATE_TIMESEFF_RATE_USDSEFF_RATE_LCURNSEFF_PID_SUID
1121411/29/20121317151346LP11115720.00020.000SYSTEM29-NOV-12 06.53.45.000000 PM116.14107665.30601382
2121511/29/20121317151346LP11115755.00055.000SYSTEM29-NOV-12 06.53.45.000000 PM116.14097665.30001383
3121611/29/20121317151346LP11115730.00030.000SYSTEM29-NOV-12 06.53.45.000000 PM0.440729.08401384

my output should come
SEFF_SUIDSEFF_INV_DATESEFF_LOT_SUIDSEFF_LOC_SUIDSEFF_TRAN_SUIDSEFF_TRAN_TYPESEFF_COMP_SUIDSEFF_AREA_SUIDSEFF_STOCK_INSEFF_STOCK_OUTSEFF_CURRENT_STOCKCREATE_USERCREATE_TIMESEFF_RATE_USDSEFF_RATE_LCURNSEFF_PID_SUID
1121411/29/20121317151346LP11115720.00020.000SYSTEM29-NOV-12 06.53.45.000000 PM116.14107665.30601382
2121511/29/20121317151346LP11115755.00075.000SYSTEM29-NOV-12 06.53.45.000000 PM116.14097665.30001383
3121611/29/20121317151346LP11115730.000105.000SYSTEM29-NOV-12 06.53.45.000000 PM0.440729.08401384

View 3 Replies View Related

SQL & PL/SQL :: Last 3 Receipts Based On Cumulative Balance?

Mar 19, 2011

I have one table where the item stock balance can be taken.What i want is like a ageing report based on the ending balance.If the ending balance is 10,000 for item a.It should bring all the Receipts which have qty lesser than 10,000.

I managed to write one function like below to get the receipts numbers but the format is 3778578-3778612-3790428 and i want to convert them into rows like

3778578
3778612
3790428

The function used is as below.

CREATE OR REPLACE FUNCTION l_get_rcpt (
l_item IN VARCHAR2,
l_date DATE,
l_bal IN NUMBER
)

[code]...

View 1 Replies View Related

Balance Calculation And Subtracting / Displaying Dates?

Sep 3, 2010

My problem is that I am working with a balance (Infor/WorkBrain - Time & Attendance) I have a balance called Bank Holiday(bal_id 10044). Every holiday that an employee works, he is allowed to take another day off in lieu of the day he worked. The employee has up to twelve months to take that holiday.

My job is to figure out when he worked that holiday (not a problem) and send an email/note at the 11 month mark and notify the employee and supervisors that said employee has 1 month to use his banked holiday.

Here is what the employee_balance log looks like.

EBLOG_IDEMP_IDBAL_IDEBLOG_DELTAWRKS_WORK_DATEWRKS_IDEBLOG_MESSAGE
51200128537100441 10/15/2010 5281229TCODE_NAME:FR_HWS
51150828537100441 7/1/2010 5136881TCODE_NAME:FR_HWS
51150928537100441 7/27/2010 5136942TCODE_NAME:FR_HWS
51150528537100441 8/1/2010 5137137TCODE_NAME:FR_HWS
5294372853710044-1 8/31/2010 5137173TCODE_NAME:FR_HWO
52947828537100441 6/3/2010 5001014TCODE_NAME:FR_HWS

My problem is the data/constraints I am working with. I can tell what day the holiday was based on a time code (EBLOG_MESSAGE) and EBLOG_DELTA shows a positive 1. I can also tell when the employee has used a bank holiday (EBLOG_DELTA is -1) and EBLOG_MESSAGE = FR_HWO.

But how to I perform the deduction so that I get four most current dates. Meaning since my first date that the employee gets for a holiday wokred is 6/3/2010 but the employee used a bank holiday on 8/31/2010. So I want to display the dates 7/1/2010, 7/27/2010, 8/1/2010 and 10/15/2010.

My preference would be not to add anything new to this table as it is a core table for Infor/WorkBrain.

View 2 Replies View Related

PL/SQL :: Balance Quantity Update In Schedule Table?

Mar 18, 2013

I have schedule table like below format:Materila Code Schedule No. Schdule Quanity Balance Quantity

ABC 1 500 500
ABC 2 300 300
ABC 3 200 200

If i received 600 quantity then data should update as below in schedule table:

ABC 1 500 0
ABC 2 300 200
ABC 3 200 200

Single material contain multiple schedules. how to programatically do the above updation.

View 15 Replies View Related

SQL & PL/SQL :: Taking Latest Current Balance Using Analytical Query

Jan 22, 2013

I am having a table with 5 lakhs transactions. I want to fetch the last balance for a particular date. So i have have returned a query like below.

SELECT curr_balance
FROM transaction_details
WHERE acct_num = '10'

[Code]...

This has to be executed for incrementing of 12 months to find the last balance for each particular month. But this query is having more cpu cost, 12 times it is taking huge time. how to remodify athe above query to get the results in faster way using analytical query. Whether this can be broken into two part in PL/SQL to achive the performance. ?

View 9 Replies View Related

Automatic Storage Management :: Does ASM Re Balance Occur Automatically

Apr 18, 2013

If the ASM Re balance occur automatically. What events can cause the ASM Re balance to be triggered?

I understand, we can manually re balance the disks in a disk group. I would like to know when this will happen automatically.

View 2 Replies View Related

SQL & PL/SQL :: Calculate Balance For Last Two Cooperative Years On Input Date

Aug 24, 2012

I need to calcuate balance for last two cooprative years on input date.

example

if input date is-->"01-AUG-2012" if (month >=7) -->then i need to calculate from 01-july-2010 to 30-june-2011 and 01-july-2011 to 30-june-2012 and 01-july-2012 to input date.

if input date is-->"01-june-2012" if (month<7) -->then i need to calculate from 01-july-2009 to 30-june-2010 and 01-july-2010 to 30-june-2011 and 01-july-2011 to input date.

how to achieve this logic

View 4 Replies View Related

Automatic Storage Management :: Re-Balance Operations Run In Serial Or Parallel

Nov 27, 2012

Background: We are migrating a lot of databases from one SAN appliance to another. We are doing this by adding new disks from the new SAN appliance to the existing disk groups, re balancing, removing the old disks from the disk groups, and then re balancing again.

Question: If I execute two ALTER commands with the same power on 2 or more separate disk groups, do both operations start executing right away? Or do they queue up and execute one after another?

I ask because we would like to queue up several re-balances so we don't have DBAs watching status bars all day.

View 7 Replies View Related

PL/SQL :: Total And Grand Total

Mar 26, 2013

I'm running a query like the below but now i would like to make the last line actually say Grand Total. Instead of just total.

SELECT   decode (grouping (farinva_invh_Code),0,null,'Total') farinva_invh_Code,
         --decode ( grouping (amt),0,null,'GrantTotal')Grant_Total,
         farinva_invh_Code,
         spriden_id,
         --spriden_last_name "last Name"

[Code]....

View 3 Replies View Related

Forms :: Opening PDF Through Oracle

Oct 28, 2009

We have a problem while opening PDF through oracle forms, we are getting the folowing error in some PC's, but some PC's this is working fine.'there was a problem reading this document 14'.

View 5 Replies View Related

Opening Permissions To Trace Files?

Nov 15, 2010

un-documented parameter _trace_files_public / I want to set this to true so my app team can review trace files. better way to proceed to open read permissions for non oracle users.

View 2 Replies View Related

Forms :: Applet Is Not Opening In Browser

Jul 26, 2011

When I click on 'Run Form', the Applet is not opening in Internet Explorer.

Giving Error like " Internet Explorer has encountered a problem and needs to close. We are sorry for the inconvenience."
Even I have re-installed the oracle 10g the same problem is coming.

Note: When I remove jinitiator and then reinstall jinitiator the applet is opening once and again if I run the form second time the same above error is coming.

View 5 Replies View Related

Forms :: Opening Existing Form In Particular Tab

Jun 5, 2011

There is a existing form B. From a form A I need to call form B on button press. Problem is form B has many tabs,It should open in the third tab when it is being opened from form A.

View 1 Replies View Related

Forms :: How To Work Without Opening OC4J

Jun 13, 2010

How to work on forms without opened oc4j..

am working on 10G .. Forms 10G

am using the OC4J for the oracle FORMS 10G to me the engine for woring maybe about 20 client ..

my question :

1- if am close the OC4j the forms closed ?
2- how to work forms to be like off line if the oc4j is closed and working tell before save .. ?

View 3 Replies View Related

Forms :: Opening New Form In Separate Tab

Dec 18, 2011

I have a multiple forms application and I use OPEN_FORM to call one form from another. However I want the new form to open in a separate tab ( the way it works in a tabbed canvas).

View 4 Replies View Related

Forms :: Opening Form Does Not Get Some Of Records?

Dec 9, 2010

I have developed a new form.Something peculiar is happening for that form.Let me list down the scenario

1)In the data base for the particular table my form is using, there are 1600 records.When i do a Query on Count Hits in the forms,it gives the same number.

2)However when i open the form ,i do not get some of the records.I found that on opening the form and making an Execute Query only those records that i have added through forms exist.

3) However,when i try to add a new record and do an Execute query again,i get all the records present in the database.

View 9 Replies View Related

Restore Datafile After Opening DB Using Resetlogs?

Mar 5, 2013

We have cloned the db and after opening the db with resetlog option we came to know that one of the user db file is not part of the db and is showing the below error while checking the status and attempting to online it. When checking the size and availability of the dbfile it shows everything without errors.

SQL> alter database datafile 50 online;
alter database datafile 50 online
*
ERROR at line 1:
ORA-01122: database file 50 failed verification check
ORA-01110: data file 50:
'+DATA/orcl/orcldata.291.730828357.dbf'
ORA-01251: Unknown File Header Version read for file number 50

View 4 Replies View Related

Restored Whole Database From Backup - Not Opening Up

Jun 5, 2013

I'm new to Oracle. I took cold backup of my database. Then, i removed my whole database while database was down.Then i restored the whole database from backup taken earlier. Now, when i try to open the database. it does not open up instead gives the below message.

Total System Global Area 1288949760 bytes
Fixed Size 1336288 bytes
Variable Size 754977824 bytes
[code]....

View 1 Replies View Related

Forms :: Opening Picture On Button Click

Oct 24, 2013

I would like to ask a very small question. what is the code that should be written to open a picture inside the button.

I have already made the button, and the trigger is when push button, what I want is when I click the button it opens a picture in this directory:

F:AmjadAmjadamjad1.jpg

the name of the picture is taken from table1 the colum serial_number

View 14 Replies View Related

Opening Of Port 1521 For Database Connectivity Through Firewall?

Nov 8, 2012

we have a database available in UNIX machine A which can be connected from client in UNIX machine B through port 1521.
If we give ping command from UNIX machine A to B or B to A, 0% packet loss, means connection established properly through firewall in port 1521.

Now we are setup one more UNIX machine C and installed a client here. This machine is available in different group, means if i give ping command from machine C to A, 100% packet loss. But from machine A to C, connection established with 0% packet loss.Because of this, when we tried to connect to a database from client in Machine C to database in Machine A, we got "time out" error.

My query is:
1. Is this because of not opening of port 1521 through firewall?
2. If so, is it enough to open port 1521 through firewall when we connect from machine C to A?
3. Any additional setup is required in firewall apart from opening of ports?

Environment:
Oracle 11.2.0.3
UNIX AIX 5.3/6.1

View 2 Replies View Related

SQL & PL/SQL :: Tab Delimited Report Not Opening In Notepad - Fine In Textpad?

May 9, 2012

I've developed a TAB delimited sql report and the report is not opening well in notepad and the same report is opening good in textpad.

create table testex(tmple_tmpl_date date,column_string varchar2(20),cnt1 number,cnt2 number,amount number(22,2))
/
Insert into testex
(TMPLE_TMPL_DATE, COLUM_STRING, CNT1, CNT2, AMOUNT)
Values

[code]...

and here is the report code

SET FEEDBACK OFF
SET VERIFY OFF
SET UNDERLINE OFF
SET NEWPAGE NONE
SET LINESIZE 999

[code]...

View 6 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved