SQL & PL/SQL :: Calculate Date When Contract Can Be Terminated
Jul 27, 2012
I've got the following table:
ID.................Date...........................number...period.....termination
434473......2012-04-18 00:00:00.000...............6.......month(s)...end of month
443080......2012-02-26 00:00:00.000...............36......month(s).....end of quarter
Now it's getting complicated. Date is the start date of a contract.
I need to calculate a date when the contract can be terminated and must compare it with the current date. Lets take the first row. In column "termination" is the termination date. A contract can be terminated at "end of month" (I need to check the last day of a month. In order to get the real termination date we need to subtract the column "number".
example 30.01.2012 - 7 month = 30.06. 2011
The thing I can do it, but my logic works only if the date is in the same year. I've been thinking a lot...sql is not important first....Have you got a theoretical solution?
View 11 Replies
ADVERTISEMENT
Sep 14, 2011
Following is the scenario:
CREATE TABLE EMP_VACATION(
EMP_NO NUMBER(3),
VAC_TYPE NUMBER(1),
START_DATE DATE,
END_DATE DATE,
START_PERIOD_DATE DATE,
END_PERIOD_DATE DATE,
PRIMARY KEY (EMP_NO,VAC_TYPE,START_DATE))
[code]....
--How to calculate START_PERIOD_DATE and END_PERIOD_DATE for every time insert reocrd, like for 4 cases?
--I need to check start_date with last period date for same employee.
And based upon calculate START_PERIOD_DATE and END_PERIOD_DATE,,,,,
View 7 Replies
View Related
Nov 29, 2011
during application migration, i got one table from MS Access, and have situation where two events are splited into 4 columns (start: date1 time1 and stop: dat2 and time2). How to properly calculate duration between these two events, and show it in format: hh:mi ?
CREATE TABLE ACCBTP_DCZASTOJ
(ID NUMBER(11,0),
NASTANAK_KVARA DATE,
VRIJ_NASTKVARA DATE,
VRIJEME_OPRAVKE DATE,
DATUM_OPRAVKE DATE);
[Code]....
View 6 Replies
View Related
Mar 28, 2013
I need a pl/sql function to calculate the financial month from an date... For eg. If i enter input date as '21-sep-2012' the function should return me the output value in months as 6. so it should calculate from april to september of that year...
View 13 Replies
View Related
May 3, 2011
Find the sample data and table.
CREATE TABLE table_x
( arrival_time VARCHAR2 (8),
post_arrival_time VARCHAR2 (8),
arrival_date date
);
INSERT INTO table_x VALUES ('3:50 PM', '3:50 AM',trunc(sysdate)); -- Post arrival date = trunc(sysdate) - 1
INSERT INTO table_x VALUES ('3:50 AM', '1:00 AM',trunc(sysdate)); -- Post arrival date = trunc(sysdate)
INSERT INTO table_x VALUES ('11:59 AM','11:59 PM',trunc(sysdate)); -- Post arrival date = trunc(sysdate) - 1
Need to calculate Post arrival date .. which will be always < = Arrival date
View 8 Replies
View Related
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
Aug 21, 2012
I have a contract that has several categories with payments in each one. If there is a payment=0, then a category is considered closed. The contract is considered closed when all categories are closed.
Date Category Payments
01/01/07 1 5
01/01/07 2 7.5
01/01/07 3 6
05/01/07 2 0
09/01/07 1 0
11/01/07 3 0
(date here is in mm/dd/yy)
I need a SQL that will return the number of months within the year that contract was open. In the example above, the last category closed on 11/01, so the result should be 10. If the last line was not there, the contract would still be open in 2007 and the result should be 12.
View 33 Replies
View Related
Jul 29, 2013
Since JDK 6, DatabaseMetaData.getCrossReference contract is :Retrieves a description of the foreign key columns in the given foreign key table that reference the primary key or the columns representing a unique constraint of the parent table (could be the same or a different table). But the Oracle JDBC Driver executed query is :
SELECT
NULL AS pktable_cat,
p.owner as pktable_schem,
p.table_name as pktable_name,
pc.column_name as pkcolumn_name,
[code]...
View 0 Replies
View Related
Jul 18, 2012
I am trying user managed recovery using archived and redo log files. I had restored old cold backup, then copy latest control file, redo log files, and archived log files at actual locations. Now I tried to recover database using following steps.
Quote:
connect sys as sysdba
startup mount;
recover database;
auto
After applied some archived files, one of the archived file corrupted and recovery cancel due to error, then i shut down the database. Now i want to copy corrupted archived file from backup and run the recovery further. so my question that should i have to run recovery from the beginning or can i run the recover from the last status of the database.
View 3 Replies
View Related
Apr 28, 2011
The following error has occurred:
ORA-06550: line 26, column 30:
PL/SQL: ORA-06552: PL/SQL: Compilation unit analysis terminated
ORA-06553: PLS-320: the declaration of the type of this expression is incomplete or malformed
ORA-06550: line 7, column 6:
PL/SQL: SQL Statement ignored
I am getting the error when i run the below anonymous block. Historic_report_data has got plenty of columns and using only the columns that are in tb_Statement in the query. It is working fine if i use a table with same number of columns as tb_statement instead of historic_report_data.
DECLARE
v_cnt NUMBER:=0;
v_data_load_error EXCEPTION;
BEGIN
dbms_output.put_line('Reconciliation scripts');
dbms_output.put_line('Reconcile tb_bank_Account_month and report_hist_data');
[code]....
View 16 Replies
View Related
Jul 8, 2012
The RMAN backup is failing daily due the below issue..
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of backup command on t1 channel at 07/08/2012 02:10:38
RMAN-10038: database session for channel t1 terminated unexpectedly
database version : 10.2.0.4.0
RMAN Script :
run {
allocate channel t1 type 'sbt_tape'
parms 'ENV=(TDPO_OPTFILE=/u001/app/TDP/p0137x/tdpo.opt)'
format '%d_inc0_%U.rbck';
backup incremental level 0 database tag OPEN_INC0_DAY;
release channel t1;
}
View 1 Replies
View Related
Oct 13, 2006
We had a good working Oracle 8i (8.1.7) database on Windows 2000 (SP 2) Inter Xeon server. A large delete operation was
initiated (deletion of 931,000 records; around 400 MB) which failed in the middle with some error messages, i don't remember.
I should have specified a special rollback segment created for this transection, but i forgot to do it. After that oracle
gives the following error in SQL Plus after I try to log in (same msg even after several reboots)
ORA-01092: ORACLE instance terminated. Disconnection forced
Here is the log file,
Dump file C:oracleadminillingdumpillingALRT.LOG
Fri Oct 13 14:19:40 2006
ORACLE V8.1.7.0.0 - Production vsnsta=0
vsnsql=e vsnxtr=3
[Code]....
Notice that that the database mounts successfully on "startup mount dbname" but it terminates with the above error messages
immediately when I give the "alter database open" command from server manager. Directly giving the "startup open dbname"
command also gives the same error message and log file.
Some one recommended adding the following line to Init.ora file for the db (if some corruption in rollback tablespace has occured)
fast_start_parallel_rollback= false
You may have seen this line in the log file above. However, it has no effect on the database functioning.
View 2 Replies
View Related
Apr 7, 2011
while statrp database am gettion error message like
" ORA-01092:ORACLE Instance terminated. Disconnected forced"
alter log file:
Errors in file g:\oracle\product\10.1.0\admin\hrdev\udump\hrdev_ora_196.trc:
ORA-01578: ORACLE data block corrupted (file # 1, block # 57371)
ORA-01110: data file 1: 'G:\ORACLE\PRODUCT\10.1.0\ORADATA\HRDEV\SYSTEM01.DBF'
Error 1578 happened during db open, shutting down database
USER: terminating instance due to error 1578
Thu Apr 07 10:06:54 2011
Errors in file g:\oracle\product\10.1.0\admin\hrdev\bdump\hrdev_pmon_86\0.trc:
ORA-01578: ORACLE data block corrupted (file # , block # )
[code]....
View 3 Replies
View Related
Dec 9, 2012
I was install oracle forms 11g r2 on windows 7 64 bit and it's work fine , but when i install oracle forms 11g r2 on windows 7 32 bit when i run my form this error appear
FRM-93652: The runtime process has terminated abnormally.
i trace my code , when i use global variable it's cause the problem , but when i don't use it the form run perfectly .
View 3 Replies
View Related
Aug 31, 2011
We are migrating Forms from 9i to 11g and we have problems with Session Timeout.
1) We have this products instal: Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 Forms 11 (Form Compiler) Version 11.1.1.4.0 (Production)
2) We compiled the forms using the parameter: compile_all=yes (Refer note: FRM-93652 When Migrating Forms from 9i/10g to 11g [ID 1053135.1])
3) We set the Timeout Parameters:
(Refer note: Description List For Parameters Affect Timeout In Webforms [ID 549735.1])
FORMS_TIMEOUT=30
HeartBeat=60
Session-Timeout=20
4) After 30 minutes we receive this error:
FRM-93652: The runtime process has terminated abnormally
And we should receive one of them:
FRM-92101 There was a failure in the Forms Server during startup.
FRM-92102 A network error has occurred.
View 2 Replies
View Related
Nov 4, 2013
I've modified a report and I am able to run the SQL from toad and executed with no errors and output the results as expected. The SQL from the report is calling a function from DB. I granted execute permisiion to public. when I run the report, it has o errors, the result were fine. However, when another user run the report, it get the the following error.
Terminated with error:
REP-300: "GET_NSCL_TOT": invalid identifier
to_char ==> (get_NSCL_Tot('NFL',to_date(:period_end_date,'DD-MON-RRRR'),'1'),'999999.99')||','col2
View 3 Replies
View Related
Jan 31, 2012
i got an error while creating database manually
View 26 Replies
View Related
Mar 29, 2012
I create a manual database "jaimaa" on windows 7 as
Microsoft Windows [Version 6.1.7600]
Copyright © 2009 Microsoft Corporation. All rights reserved.
C:\Users\SARASWATIMAA>SET ORACLE_SID=JAIMAA
C:\Users\SARASWATIMAA>SQLPLUS
SQL*Plus: Release 10.2.0.1.0 - Production on Thu Mar 29 23:19:31 2012
Copyright © 1982, 2005, Oracle. All rights reserved.
Enter user-name: SYS AS SYSDBA
Enter password:
Connected to an idle instance.
SQL>
SQL> STARTUP NOMOUNT
ORACLE instance started.
Total System Global Area 117440512 bytes
Fixed Size 1247588 bytes
Variable Size 58721948 bytes
Database Buffers 50331648 bytes
[Code].....
View 1 Replies
View Related
Sep 25, 2012
I regularly upload various tab-delimited text data files with SQL Loader. The control files always specify TERMINATED BY X'09'. Certain columns in those data files may be null for some rows, i.e. there is no character between two subsequent tabs. It always works like a clock.
Now, I have run into a specific case where I have to strip a data column of double quotes that may or may not enclose the actual data (side effect of a text export from Excel).
I tried simply adding OPTIONALLY ENCLOSED BY '"' behind the terminated delimiter and it did work for the file and column in question. Still, with this new option, files with null values are no longer decoded correctly. The loader seems to simply skip those values, which provokes column shifts and results in either a corrupt load, or a load failure.
For now, I've got a workaround dropping the new option and executing an SQL script eliminating double quotes directly in the database, but that obviously cannot last.
View 3 Replies
View Related
Dec 6, 2012
When i do run export command through command prompt, its shows below error.
Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp.
C:Documents and SettingsAdministrator>Exp disdeva/disa123@distesta file=D:DAI LY_BACKUPdistesta.dmp log=D:DAILY_BACKUPdistesta.log statistics=none buffer=5 000000 owner=distesta
Export: Release 10.2.0.3.0 - Production on Thu Dec 6 15:06:21 2012
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Release 10.2.0.3.0 - Production Export done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set
server uses AL32UTF8 character set (possible charset conversion)
About to export specified users ...
EXP-00010: DISTESTA is not a valid username Export terminated successfully with warnings.
C:Documents and SettingsAdministrator>
When i connect from sqlplus, it doesn't give any erro. What could be the reason?
SQL> conn disdeva/disa123@distesta
Connected.
SQL>
View 8 Replies
View Related
Sep 14, 2012
SQL> startup mount
ORACLE instance started.
Total System Global Area 905969664 bytes
Fixed Size 1293720 bytes
Variable Size 520094312 bytes
Database Buffers 377487360 bytes
Redo Buffers 7094272 bytes
Database mounted.
SQL> alter database noarchivelog;
Database altered.
SQL> alter database open; alter database open
ERROR at line 1: ORA-00603: ORACLE server session terminated by fatal error
View 3 Replies
View Related
Feb 23, 2012
Backup for database has been working fine until today.
Today, about 1/3 of the way through the backup (large database), I got this...
RMAN-12005: error during channel cleanup
RMAN-10038: database session for channel sbt_4 terminated unexpectedly
...and the backup died.
Never seen before and the research I've done online has been less than useful. This database is an SAP/oracle db with brtools 7.20 (22) and is using the new parameter in its init.sap file, called "_rman_chan_failo = yes", to address disagreement between brtools and oracle about channel drops being ok if all datafiles backed up.
Nothing in the alert log at the time of this error.
View 4 Replies
View Related
May 1, 2012
impdp system/manager1 directory=dmpdir parfile=impdp_smp.txt
$cat impdp_smp.txt
dumpfile=full_0501_1.dmp,full_0501_2.dmp,full_0501_3.dmp,full_0501_4.dmp
schemas=smp
exclude=table:"in ('SFCS_SN_SITE_STATISTICS','KP_KEYPART_RUNCARD','CELL_SORT_INFO_BY_CUSTOMER',
'WIP_RUNCARD','KP_KEYPART_FLEX','SFCS_SN_SITE_STATISTICS _MV') "
remap_tablespace=USERS:APP_TB,SYSTEM:APP_TB
logfile=impdp_smp.log
parallel=4
impdp error:
ORA-39014: One or more workers have prematurely exited.
ORA-39029: worker 1 with process name "DW01" prematurely terminated
ORA-31672: Worker process DW01 died unexpectedly.
Job "SYSTEM"."SYS_IMPORT_SCHEMA_01" stopped due to fatal error at 12:26:24
ORA-39014: One or more workers have prematurely exited.
View 10 Replies
View Related
Dec 20, 2011
I am still getting the erros.
C:>set oracle_sid = sidname C:>set oracle_sid oracle_sid = sidname
C:>sqlplus SQL*Plus: Release 11.2.0.1.0 Production on Wed Dec 21 01:49:06 2011 Copyright (c)
[code]....
View 2 Replies
View Related
Mar 19, 2010
I got this error after i patch to 10.2.0.4.0. Before patch, database running smooth.
I shutdown as usual using shutdown only.
View 8 Replies
View Related
Sep 19, 2012
I noticed that my standby server was behind the prduction one.In the error log I noticed: ORA-00600: internal error code, arguments: [kcbr_apply_change_11], [], [], [], [], [], [], [], [], [], [], []
then
MRP0: Background Media Recovery terminated with error 448
Recovered data files to a consistent state at change 286116915
This error happens in sequence: Recovery of Online Redo Log: Thread 1 Group 4 Seq 8830 Reading mem 0I found this archive log in standby and it is same size as in the production one.
View 9 Replies
View Related
Jun 1, 2010
I'm trying to work out how to take a table like this:
IDDate
12502-Feb-07
12516-Mar-07
12523-May-07
12524-May-07
12525-May-07
33302-Jan-09
33303-Jan-09
33304-Jan-09
33317-Mar-09
And display the data like this:
IDPeriodPeriod StartPeriod End
125102-Feb-0702-Feb-07
125216-Mar-0716-Mar-07
125323-May-0725-May-07
333102-Jan-0904-Jan-09
333217-Mar-0917-Mar-09
As you can see, it's split the entries into date ranges. If there is a 'lone' date, the 'period start' and the 'period end' are the same date.
View 13 Replies
View Related
Apr 12, 2010
I have a two date fields in my form; valid from date and expiry date.
Currently my valid from date has an inital value property of $$date$$ which automaitcally brings up todays date.
I need my expiry date to automatically show a date 15 years after this date?
View 8 Replies
View Related
Oct 12, 2012
why Database session was not terminated for failed reports request processed by reports engine.
My engine element parameters are as followed:
<engine minEngine="3" maxIdle="30" maxEngine="16" id="rwEng" engineResponseTimeOut="10" engLife="50" class="oracle.reports.engine.EngineImpl">
<property value="/home/TMAP/KO/shared/reports" name="sourceDir"/>
<property value="no" name="keepConnection"/>
<property value="no" name="diagnosis"/>
</engine>
<engine minEngine="0" maxEngine="1" id="rwURLEng" engLife="50" class="oracle.reports.urlengine.URLEngineImpl"/>
View 6 Replies
View Related
Jul 26, 2010
While creating the index we are getting the error "ORA-00603: ORACLE server session terminated by fatal error".
We have the space in tablespaces and also in the file systesm.
View 13 Replies
View Related