Data spliting procedure
hi all,
i would like to write a procedure which split amount principle and income amount as following order.
i have data stored in this form
due_no principle income due_amt serial_no
1 500 200 700 1
2 500 200 700 2
3 500 200 700 3
4 500 200 700 4
4 500 200 700 100
4 500 200 700 100
4 500 200 700 100
i want to split priciple and income amount in case of repeatation of due_no
like
due_no principle income due_amt serial_no
1 500 200 700 1
2 500 200 700 2
3 500 200 700 3
4 200 0 200 4
4 150 0 150 10
4 150 50 200 10
4 0 200 200 10
first due_amount should cover principle portion then comes to the income
thanks in advance
I hope that you do realize that your "original data" from your last post is totally different than the one in your original post ...
Anyway, here is a solution:
SQL> create table mytable
2 as
3 select 1 due_no, 500 principle, 200 income, 700 due_amt, 1 serial_no from dual union all
4 select 2, 500, 200, 700, 2 from dual union all
5 select 3, 500, 200, 700, 3 from dual union all
6 select 4, 500, 200, 200, 4 from dual union all
7 select 4, 500, 200, 150, 10 from dual union all
8 select 4, 500, 200, 200, 11 from dual union all
9 select 4, 500, 200, 150, 12 from dual
10 /
Tabel is aangemaakt.
SQL> select due_no
2 , least
3 ( due_amt
4 , greatest
5 ( 0
6 , principle - sum(due_amt) over (partition by due_no order by serial_no) + due_amt
7 )
8 ) principle
9 , least
10 ( greatest
11 ( 0
12 , sum(due_amt) over (partition by due_no order by serial_no) - principle
13 )
14 , due_amt
15 ) income
16 , due_amt
17 , serial_no
18 , sum(due_amt) over (partition by due_no order by serial_no) running_sum
19 from mytable
20 /
DUE_NO PRINCIPLE INCOME DUE_AMT SERIAL_NO RUNNING_SUM
1 500 200 700 1 700
2 500 200 700 2 700
3 500 200 700 3 700
4 200 0 200 4 200
4 150 0 150 10 350
4 150 50 200 11 550
4 0 150 150 12 700
7 rijen zijn geselecteerd.Regards,
Rob.
Similar Messages
-
What are the CRM Trasaction data Data Sources and Data load Procedure
Hi BI Gurus,
Does anybody provide the CRM Transaction data DataSources names and Load procedure into BI7.0
I know the master Data load procedure from CRM to BI7.0.
if you provide Step-by-Step documents it is more help.
Thanks in Advance,
VenkatHi Venkat
In order to find the transactions want you can login the CRM system and then use the transaction RSA6. There you can expand all the subtrees by left clicking on the first line and then clicking expand the further left button. After that you can easily search any datasource you may want
Hope that helps
Rgds
John -
Pass Parmeter To Sql Data Base Procedure
Hi,
i used JDEVADF_11.1.1.4.0
I have two fields Date type on the Page, and I have a Procedure database gives difference between two dates, on the road to send the values of the two date , and give me the number of days
I make a call the Procedure in AppModuleImpl
How can I send the parameter two dates from the screen to data base Procedure , for run the ProcedureHi,
Bind the dates value to the bean and call the IMPL method with help of these value passed as argument .
The IMPL method must exposed as client interface so that bean can access that method.
@Gunanidhi -
Data selection procedure 400 could not find any data
Hi ,
I am getting the Information message "Data selection procedure 400 could not find any data " while doing the Result recording of a inspection lot
Inspection lot status :- REL CALC
Inspection lot Origin :- 04 GR from production order
No user status active
This message i am getting in some inspection lot only
Kindly help me to understand the possible resaon for this message
Thanks,
Ishwarhi,
u r using any copy inspection result like of thing, if not than please provide the Mssg number. and possible than check ur plan properly.
F9 i have checked, this prblm occurs when u using the Copy inspecttion result during RR in QA32, ma suggesstion is to checck ur config "Copy inspection results" in SPRO properly against inspection type "04", and than check ur qaulity plan, than execute it will resolve.
For more information:
SPRO Settings: COPY INSPECTION RESULTS DURING RESULTS RECORDING
Regards
Edited by: D GURU on Dec 5, 2011 8:35 AM -
All,
How to view the size of Data cache & procedure cache?
how to estimate the cahe size taken for a given query? Say for exampe, If i run a query , I just wanted to know how much of cache memort it took.karthi_mrkg wrote:
All,
How to view the size of Data cache & procedure cache?
how to estimate the cahe size taken for a given query? Say for exampe, If i run a query , I just wanted to know how much of cache memort it took.Judging from this, and your other question on locking, you seem to have a background in some other SQL DBMS, other than Oracle...
It might be a good idea that you spend a day or two, studying the Oracle Concepts guide. -
Troubleshooting data load procedure
Hi folks,
I am trying to load data into a model built in cube builder. My data load procedure, which is for a single variable, is failing. Here are details:
Dim structure as follows:
DIM CHANNEL:
SALES_CHANNEL (Output)
SUB_CHANNEL (Input)
DIM BUSINESS_UNIT:
BUS_UNIT (Output)
BDM (Input)
Data is in an MS Access table called FACT_NETSALES, with columns SALES_CHANNEL, SUB_CHANNEL, BUS_UNIT, BDM, and time ranging from Oct 2009 to November 2010.
Data sample:
SALES_CHANNEL SUB_CHANNEL BUS_UNIT BDM Oct-09 Nov-09 Dec-09
CH1 CH1SUB1 BUS1 BUS1BDM1 999999.99 999999.99 999999.99
CH2 CH2SUB1 BUS1 BUS1BDM1 999999.99 999999.99 999999.99
CH2 CH2SUB2 BUS1 BUS1BDM1 999999.99 999999.99 999999.99
CH2 CH2SUB3 BUS1 BUS1BDM1 999999.99 999999.99 999999.99
CH3 CH3SUB1 BUS1 BUS1BDM1 999999.99 999999.99 999999.99
CH4 CH4SUB1 BUS1 BUS1BDM1 999999.99 999999.99 999999.99
CH5 CH5SUB1 BUS1 BUS1BDM1 999999.99 999999.99 999999.99
CH5 CH5SUB2 BUS1 BUS1BDM1 999999.99 999999.99 999999.99
CH5 CH5SUB3 BUS1 BUS1BDM1 999999.99 999999.99 999999.99
CH6 CH6SUB1 BUS2 BUS2BDM1 999999.99 999999.99 999999.99
CH6 CH6SUB1 BUS3 BUS3BDM1 999999.99 999999.99 999999.99
CH6 CH6SUB1 BUS3 BUS3BDM2 999999.99 999999.99 999999.99
CH6 CH6SUB1 BUS4 BUS4BDM1 999999.99 999999.99 999999.99
CH6 CH6SUB1 BUS5 BUS5BDM1 999999.99 999999.99 999999.99
CH6 CH6SUB1 BUS6 BUS6BDM1 999999.99 999999.99 999999.99
CH6 CH6SUB1 BUS7 BUS7BDM1 999999.99 999999.99 999999.99
Here's the procedure:
CLEAR STATUS
USE INITIAL RETAIN
SET Control DB_Name CLIENTTEST
USE &DB_Name UPDATE
CHE UPD
SET Control App_Periodicity MONTHLY
SET Control App_Period October 2009 - November 2010
SET DATE MDY
SET &App_Periodicity
SET PERIOD &App_Period
SET Control App_FACT_Table FACT_NETSALES
SET Control DW_Link LNK_CLIENT
SELECT VAR KPI1_ACT
SELECT CHANNEL
SELECT BUSINESS_UNIT
ACROSS TIME DOWN CHANNEL, BUSINESS_UNIT, VAR
ACCESS LSLINK
CONNECT &DW_Link
BEGIN
SELECT
SALES_CHANNEL,
SUB_CHANNEL,
BUS_UNIT,
BDM,
DATE
FROM &App_FACT_Table
END
Peek only 10
LSS CREATE CHANNEL = SALES_CHANNEL
READ
END
The error I get is:
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
SQLSTATE: 07001
SQL System code: -3010
What's wrong with the procedure?
Thanks in advance for your help!I figured it out. I was selecting two levels of a single dimension in the SQL statement.
-
Problems with date in procedure on Oracle 11g
Hi gurus,
I have some problems with the date format on Oracle 11g.
Let me explain the situation:
When I am starting a request like
select to_number(to_char(to_date('01.04.2009','dd.mm.yyyy'), 'yyyy'))
from sys.dual
I got as result 2009 as number.
When I do the same in a procedure of a package like this
my_year := to_number(to_char(to_date('01.04.2009','dd.mm.yyyy'), 'yyyy'));
the variable my_year contains the value 9 instead of 2009.
Can someone explain me what's going wrong?
I have just tested with changing the environment variable nls_date_format for the session and for the complete database with no success.
Regards,
BjörnThank you all for your replies so far:
@Alex: You are right, using your short script in sqlplus gives me also 2009 as result
So, I am now posting the essential excerpts of the procedure because the whole one is to large:
function insert_szrl (my_fremd_name varchar, my_elementadresse varchar,
my_zeitstempel varchar, my_wert float,
my_status varchar, my_zyklus varchar,
my_offset integer,
my_quelle varchar, my_nzm_daten integer) return integer is
begin
my_date := to_date (substr (my_zeitstempel, 1, 10), 'dd.mm.yyyy') + my_tageswechsel +1/24;
if my_zyklus = 'mm' then
my_zeitstempeldate := add_months(to_date(last_day(to_date(my_date, 'dd.mm.yyyy')), 'dd.mm.yyyy'),-1) +1 + (my_tageswechsel+1/24);
my_days := to_date(last_day(to_date(my_date, 'dd.mm.yyyy')), 'dd.mm.yyyy') - add_months(to_date(last_day(to_date(my_date, 'dd.mm.yyyy')), 'dd.mm.yyyy'),-1);
my_year := to_number(to_char(to_date(my_date,'dd.mm.yyyy'), 'yyyy'));
ptime.umschalttage_tuned (my_year, my_ws, my_sw);
end if;
While debugging the complete procedure I see since the start only a date which looks like '01.04.2009 07:00:00'
Edited by: user10994305 on 19.05.2009 15:58
Edited by: user10994305 on 19.05.2009 15:58 -
Foreign trade data: import procedure determination in PO
Hi,
The import procedure field in my PO is sometimes filled in sometimes not. When I use PO-Type ZFA I get my import procedure automaticaly filled. When I use PO-Type ZRP i do not get it filled in. Although the Article, supplier and plant are exactly the same. Where can I give in the default value for import procedure for each PO-type?hi,
please check this
Sales and Distribution -- Foreign Trade/Customs -- Basic Data for Foreign Trade -- Define Business Transaction Types And Default Value -
Error Inserting Data from Procedure ODI 11g (No data)
Hi everyone!
I have a problem inserting data from a procedure, the procedure works "fine" (no errors), on the log counter shows the number of rows inserted, but, on the database rows does not exists, an easy sample is:
TARGET: ORACLE
insert into table_t
(desc)
values
(:description)
SOURCE: ORACLE
select description from table_s
I check (ODI), the conection (works fine), modules (works fine), "select from table" (works fine).
I check (Database), inserting rows direct (works fine).
What can i check?
Thanks for your response.Hi
Try below 2 things
First
In target:oracle
insert into table_t
(desc)
values
('#descpt');
Second
In target:oracle
insert into table_t
(desc)
values
('#Proc_Var');
Note: For alias name (*descpt* ) or Project variable (*Proc_Var*) with # symbol and single quotes
Regards,
Phanikanth -
About 'External data' and 'Procedure' option in PLD
Hi all,
Can u please tell me what is the use of 'procedure' option in PLD.we can get this option when we select any text then in the genral tab of properties if we select field type as 'EXTERNAL DATA' then in the content tab we get source type 'PROCEDURE NAME'.
Please give me example of this.chetan,
You can use external data field to display
company logo,Signatures etc., that is of legal importance.
Create company logos's/signatures and run it as a dll file.
Add dll file in procedure name in external data field.
Jeyakanthan -
Best way to return structured data?procedure or function?
Hi everyone.
I cannot choose the best way to return, from java stored procedure, some data.
for example , which is best way to write this method:
public STRUCT function(input parameters) { STRUCT result ... return result; }
or
public void procedure(input parameters, STRUCT[] struct) { STRUCT result ... struct[0] = result; }
in the last way, the wrapper obviously will be: CREATE PROCEDURE name(... IN datatype, data OUT STRUCT)
Which is best way in efficiency ?
thank you ;)da`,
By "efficiency", I assume you mean, best performance/least time.
In my experience, the only way to discover this is to compare the two, since there are many factors that affect the situation.
Good Luck,
Avi. -
OS X Snow Leopard Looking for an explanation for an DIY Harddisk data recovery procedure
Hi There,
Yesterday my 13" Unibody MacBook (A1278) popped up an "Invalid B-Tree Node Size" Mac OS X Error. searching the internet for on a solution and explanation so far gave me headaches. And did not provide me guidance for an proper Do It Yourself procedure. Off course I want to have data recovered for which no backup is available (a forced clean install now is not an option!). When booting with the install DVD and then using Diskutility fails (yes the simple recovery does not work in my case). I read about using third party software solutions (e.g. data rescue or DiskWarior) but the how to is not clear to me, which steps need to be performed ? How can such an data recovery process be performed ? What sort of hardware or wires are needed to do this ? The only Apple Machines I can use now are a other 15” MacbookPro and an Windows XP desktop. I bought a Sharkoon SATA Quickport XT (USB3) but this product is still wrapped because I am not sure it will (or I will get it to) run under OS X. So again can anyone provide me a walkthrough for such a (troubleshooting) HDD data recovery process?
The data that needs to be recovered concerns foto's and PhD writing material in the end process of some to be published articles.
Thnx in advance for your comment!First order of busness is to get your data off the 13"
If this data is of extreme importance, your better off letting a professional computer support specialist handle it.
Do not use Disk Warrior yet, it could make matters worse. Your data needs to be recovered and it can be provided nothing further is done to the drive.
The first 3 methods below are designed to be passive, just trying to read the data and get it safely off the hard drive first.
There is no need to extract the hard drive from the computer yet. This in itself can cause further damage.
1: Unwrap the Sharkoon SATA Quickport XT USB 3 and stick a blank internal drive in it.
If you don't have one, then return that device and/or get yourself a external powered USB 3, 2 or 1 (3 is backward compatible with 2, 1) hard drive, runs about $100 for a 1TB drive.
Hook this drive up to the 15" MacBook Pro and in your Utilities Folder is Disk Utilities.
Select this new drive and Erase > format it HFS+ Journaled with Security Option > Zero all data. (going to take a bit to complete)
2: Use the Windows PC or the 15" MacBook Pro to download a ISO copy of PartedMagic. Burn it to a blank cd using Windows 7 right click and burn, or using the free ImgBurn for Windows. Or using Disk Utility on OS X.
http://partedmagic.com/doku.php?id=screenshots
Hook up the now finished USB external drive (or the Quickport) to the 13" MacBook and power up.
Once the cd is burned, stick it in the MacBook and reboot holding option and c, keep holding and you will have a option to load into RAM. DO so and the disk will spit back out.
In the screen on the left is a icon called MountDevices, doubleclick it twice to get two file transfer windows. Use the third window to mount your disks. Use the two file transfer windows to navigate and transfer your files off to the external drive using drag and drop methods.
Once that's completed, unmount the drives and use the lower left corner to exit. Reboot.
Take the external drive to the 15" MacBook Pro and verify your files are there.
3: Another method if the PartedMagic cd doesn't work, is to c boot off the MacBook install disks on the MacBook, use Disk Utility to format the external drive HFS+ Journaled and install OS X on it. It might be hold option bootable, but I'm not sure if older machines can boot from a USB, usually it's Firewire for them and you don't have Firewire.
Last would be to extract the hard drive from the computer if it's easily done through the battery port then stick it in the SATA Quickport port and hook it up to the 15" and transfer your files off. If your having disk reading errors, then on the 15" MBP download and install DataRescue, it will read the files directly via the 1's and 0's of the files themselves. Data Rescue and other recovery software needs another drive to send data to, can't recover back to the problem drive.
http://www.prosofteng.com/products/data_rescue.php
Once the data is off, you can hold c, boot from the OSX install disk for the MacBook and from the utilities menu select Disk Utility and erase (with Security option Zero all data) and format the drive HFS+ Journaled and quit, reinstall OS X again. Or you can try using Disk Repair/Warrior and see if that works. (only works from another boot drive/disk). Or use the 15" to format the drive and stick it back into the 13" -
Help understanding how to pass dates to procedures in a package?
When I run the following script in SQL*Plus, I get no obvious errors, but the truncate does not happen and all the other processing doesn't happen. I ran a similar version in another tool and it worked. Much of the code is deleted here but I believe I don't fully understand passing dates in the procedure. I figure if one of the dates ends up null or something invalid, the procedure will run and give no results. If someone could correct me on how to pass variables, it would help greatly. As you can see, I am passing 2 dates in from an ACCEPT statement, passing them to 1 shell type procedure which runs other procedures and passes the dates to the procedures below it. This procedures calls the 3rd procedure and passes the same dates to it:
ACCEPT CUR_PERIOD PROMPT 'Current Period (MM/DD/YYYY): ';
ACCEPT PRIOR_PERIOD PROMPT 'Prior Period (MM/DD/YYYY): ';
EXEC RCO.MONTH_END_PACK_1.MONTHENDPHASE1PROC('&CUR_PERIOD','&PRIOR_PERIOD');
The spec looks like this:
CREATE OR REPLACE PACKAGE MONTH_END_PACK_1 AS
PROCEDURE MonthEndPhase1PROC(get_cur_period IN DATE, get_prior_period IN DATE);
PROCEDURE W_CAT_INFO_RPT_PROC(GET_CUR_PERIOD IN DATE, GET_PRIOR_PERIOD IN DATE);
PROCEDURE WO_CAT_INFO_RPT_PROC(GET_CUR_PERIOD IN DATE, GET_PRIOR_PERIOD IN DATE);
END MONTH_END_PACK_1;
The body looks like this:CREATE OR REPLACE PACKAGE BODY MONTH_END_PACK_1 AS
PROCEDURE MonthEndPhase1PROC(get_cur_period IN DATE, get_prior_period IN DATE) IS
BEGIN
EXECUTE IMMEDIATE 'TRUNCATE TABLE RPT_DS1_CNT';
EXECUTE IMMEDIATE 'TRUNCATE TABLE RPT_DS1_CNT_CAT';
W_CAT_INFO_RPT_PROC(GET_CUR_PERIOD, GET_PRIOR_PERIOD);
END;
PROCEDURE W_CAT_INFO_RPT_PROC(GET_CUR_PERIOD IN DATE, GET_PRIOR_PERIOD IN DATE) IS
CUR_PERIOD DATE;
PRIOR_PERIOD DATE;
BEGIN
-- Assign the dates to this procedure that were passed in above.
CUR_PERIOD := GET_CUR_PERIOD; --07/27/2007
PRIOR_PERIOD := GET_PRIOR_PERIOD; --06/27/2007
-- Execute stored procedure, passing in dates.
WO_CAT_INFO_RPT_PROC(CUR_PERIOD, PRIOR_PERIOD);
-- Other code goes here
END; -- W_CAT_INFO_RPT_PROC
PROCEDURE WO_CAT_INFO_RPT_PROC(GET_CUR_PERIOD IN DATE, GET_PRIOR_PERIOD IN DATE) IS
CUR_PERIOD DATE;
PRIOR_PERIOD DATE;
BEGIN
CUR_PERIOD := GET_CUR_PERIOD;
PRIOR_PERIOD := GET_PRIOR_PERIOD;
INSERT INTO RPT_DS1_CNT
(select distinct trim(CVBI_KEY) as CVBI_KEY, vendor_id
from
(select m.cvbi_key, v.vendor_name
from rco.cogs_resource m,RCO.COGS_SRVCTYP st,rco.cogs_mkt ms,RCO.COGS_VENDOR v,
(select distinct cvbi_key, vendor_id
from RCO.COGS_resource
where period = CUR_PERIOD)ak
where ak.cvbi_key = m.cvbi_key
and trim(m.cvbi_key) = trim(st.cvbi_key(+))
and period = CUR_PERIOD));
END;
END;
/EXEC RCO.MONTH_END_PACK_1.MONTHENDPHASE1PROC(to_date('&CUR_PERIOD','MM/DD/YYYY'),to_date('&PRIOR_PERIOD','MM/DD/YYYY'));
As you can see, I am passing 2 dates in from an ACCEPT statementUntil you convert them using TO_DATE they are just strings
Message was edited by:
3360
Fixed date formats -
Passing date to procedure help
Hello, this maybe simple question, but I couldn't figure out why I am getting
ORA-01843: not a valid month.. Here is what I did:
exec proc(to_date('01/01/2007','MM/DD/YYYY'),to_date(01/30/2007,'MM/DD/YYYY'))NLS setting is: DD-MON-RR
procedure proc (date1 in date, date2 in date)
v_date_period varchar2;
select date_period into v_date_period from t1 where start_date = to_date(date1,'MM/DD/YYYY') and end_date = to_date(date2,'MM/DD/YYYY');
start_date and end_date are in date MM/DD/YYYY format in the table, but the above code is failed b/c of the above error.
One thing I noticed that when dates are passed into the procedure, they come in DD-MON-RR format and the comparion never works in cursor. start_date and end_date are in MM/DD/YYYY format. but it works only when to_date(date1,'DD-MON-RR') and to_date(date2,'DD-MON-RR'). How is it working when start_date and end_date are in MM/DD/YYYY format???
another question is, when I say To_date, does it always convert any date to NLS setting? I used
to_date('01/01/2007', 'dd/mm/yyyy'), but it doesn't have any effect when it goes to the procedure.. still comes as DD-MON-RR.
what mistake i am doing? I would appreciate your ans. Thanks,I think I got it now. I really didn't need that extra
conversion within the procedure. It works now. Then let's make sure it's clear for you.
You are right to consider the NLS_DATE_FORMAT settings, that's good, as most people are unaware of it and really have no understanding whatsoever as to what it does. Perhaps your understanding of it is not quite up to scratch just yet...
The setting relates to how oracle converts between dates and strings when no format is specified explicitly. e.g.
SQL> select to_char(sysdate) from dual;
TO_CHAR(SYSDATE)
04/03/2008 10:00:11
SQL> alter session set nls_date_format = 'YYYY MON DD';
Session altered.
SQL> select to_char(sysdate) from dual;
TO_CHAR(SYS
2008 MAR 04
SQL> select to_char(sysdate, 'DD/MM/YYYY') from dual;
TO_CHAR(SY
04/03/2008
SQL>Likewise if you convert the other way from a string to a date...
Firstly with implicit conversion, which will assume the NLS_DATE_FORMAT setting format for the string...
SQL> select to_date('2008 JAN 01') from dual;
TO_DATE('20
2008 JAN 01And then if you explicitly convert specifying the format...
SQL> select to_date('01/01/2008','DD/MM/YYYY') from dual;
TO_DATE('01
2008 JAN 01However if you try and implicitly convert (using the NLS setting) but the string isn't of the correct format...
SQL> select to_date('01/01/2008') from dual;
select to_date('01/01/2008') from dual
ERROR at line 1:
ORA-01843: not a valid month
SQL>So now let's look at what you were doing...
select date_period into v_date_period
from t1
where start_date = to_date(date1,'MM/DD/YYYY')
and end_date = to_date(date2,'MM/DD/YYYY');Your date1 and date2 are already of a DATE datatype. This means that they are already stored in the oracle internal date format. Note: ALL dates are stored the same internally regardless of how they are displayed. e.g.
SQL> select sysdate, dump(sysdate) from dual;
SYSDATE
DUMP(SYSDATE)
04/03/2008 10:35:20
Typ=13 Len=8: 216,7,3,4,10,35,20,0
SQL> alter session set nls_date_format = 'YYYY MON DD HH24:MI'
2 ;
Session altered.
SQL> select sysdate, dump(sysdate) from dual;
SYSDATE
DUMP(SYSDATE)
2008 MAR 04 10:36
Typ=13 Len=8: 216,7,3,4,10,36,50,0
SQL>However, you are using the to_date function. This expects the first parameter to be a string and the second parameter is an optional string specifying the format of the first string.
So it was expecting:
to_date(<string>,<string>)and you gave it
to_date(<date>,<string>)When oracle comes across this sort of thing, rather than produce an error it recognises that it is able to do an implicit conversion of datatypes so internally it is doing
to_date(to_char(<date>),<string>)Note: because it is an implicit conversion within the "to_char" it is using the NLS settings to do this.
You said your NLS setting was DD-MON-RR, so this is the same as...
to_date(to_char(<date>,'DD-MON-RR'),<string>)Now look at your code again with the implicit conversions in place...
select date_period into v_date_period
from t1
where start_date = to_date(to_char(date1,'DD-MON-RR'),'MM/DD/YYYY')
and end_date = to_date(to_char(date2,'DD-MON-RR'),'MM/DD/YYYY');Hmmm, so the to_date function is getting it's first parameter as a string in the format 'DD-MON-RR' and the second parameter is telling it that the first parameter is in the format 'MM/DD/YYYY'.
The two dates you passed were:
'01/01/2007'
and
'01/30/2007'
But after the implicit conversion your code looks like...
select date_period into v_date_period
from t1
where start_date = to_date('01-JAN-07','MM/DD/YYYY')
and end_date = to_date('30-JAN-07','MM/DD/YYYY');As you can see there are numerous problems with this. The first one Oracle errored on was the fact that 30 is not a valid Month as defined by your format string.
Hopefully that clarifies things a little more for you and you'll understand a little more about the differences between strings, dates and implicit and explicit conversion between the two using format strings and the NLS setting.
;) -
Passing Date to procedure give Problem
heloo...
I have two database schema, And both schema contain same procedure with Date as argument.
that procedure workes well in one schema but it give error of "INVALID MONTH" in another schema.
Any sollution of this?
ThanksWhy it is working fine in one schema and it give error in another schema? You did not post the most important part of your problem (how are you calling this procedure), but as indicated, if you are passing a string that looks like a DATE, then it can be converted to a date only using the database implicit conversion logic that will rely on NLS seetings (and those can well be different for the two users).
See replies above on how to fix this.
Maybe you are looking for
-
GR/IR not cleared with F.19
Hello! I use F.19 to regroup the GR/IR account at month end. I select "GR/IR clearing" on the Parameters tab in order to have the GR/IR account cleared at the same time. Unfortunately the account is not cleared. Has anyone experienced this issue befo
-
How do I delete an e-mail from address books
I have an e-mail address in my address book that is frozen. I am having a problem editing it or deleting it. What to do?
-
I have no idea what I am doing? can you read my question? Thank you
-
Using the internet on an Ipod touch
How does the internet work on an Ipod touch? Does it only work through wifi? or can u set up a personal internet account specifically for the ipod that you would pay monthly for?
-
Another tip for working around iDVD encoding errors: Use internal drive
I've had several projects that produced the encoding error while rendering the menus, I've also seen a number of tips in this discussion area, e.g., have 20 GB of free space, delete iDVD preferences, delete encoded assets, and make sure your chapter