Script to insert the date of a certain range of periods
This is my situation. There is a call from thing in convention in Oracle EBS capital proportion.
I have to make a rule of prorated on a daily basis.
The first date starts at the year 1942. I can do it manually, but continually press TAB on my keyboard it'll take more than 4 hours to complete all the data until 2015.
That's why I need a script to enter in the
START_DATE
END_DATE
PRORATE_DATE
Ex
1 JANUARY 1949 START_DATE END_DATE 1 JANUARY 1949 PRORATE_DATE 1 JANUARY 1949
JANUARY 2, 1949 START_DATE END_DATE 2 JANUARY 1949 PRORATE_DATE JANUARY 2, 1949
JANUARY 3, 1949 START_DATE END_DATE 3 JANUARY 1949 PRORATE_DATE JANUARY 3, 1949
'
'
'
31 DECEMBER 2015 START_DATE END_DATE DECEMBER 31, 2015 PRORATE_DATE 31 DECEMBER 2015
Hello
Here's a way
INSERT INTO table_x (start_date, end_date, prorate_date)
WITH params AS
(
SELECT DATE ' 1942-01-01' first_date - OR 1949, or something else
, DATE '' 2015-12-31 AS last_date
OF the double
)
all_dts AS
(
SELECT the LEVEL - 1 AS dt + first_date
OF params
CONNECT BY LEVEL<= 1="" +="" last_date="" -="">=>
)
SELECT dt, dt, dt
Of all_dts
;
I hope that answers your question.
If this isn't the case, please post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and also publish outcomes from these data. After all right on this site, without the parts attached.
If you ask a DML statement, such as INSERT, INSERT statements, you post (as applicable) will be the content of the or the tables before the DML, and the results will be the State of the or a modified tables when it's all over.
Explain, using specific examples, how you get these results from these data.
Always say what version of Oracle you are using (for example, 11.2.0.2.0).
See the FAQ forum:Re: 2. How can I ask a question on the forums?
Tags: Database
Similar Questions
-
script to change the data type of column
Hi gurus of the oracle.
I have 190 tables in my database.
I have the column type CHAR of all these tables data.
I need to change the data type of CHAR in VARCHAR2 for all these tables...
There the script to change the data type of all tables at once?
Please help me in this regard.
Thanks in advance
Concerning
REDA
Hello
There is nothing built-in to Oracle SQL to do. Maybe your front-end has certain characteristics.
You can write dynamic SQL statements to do. In other words, you can write a query that the output is a SQL script like this:
ALTER TABLE TABLE_A CHANGE (A_TXT1 VARCHAR2 (5))
A_TXT2 VARCHAR2 (10));
ALTER TABLE TABLE_B CHANGE (B_TXT1 VARCHAR2 (5));
with one row for each column of type CHAR. Notice how the first line of output for each table begins with ALTER TABLE... but the later lines at the same table. Similarly, the last line of a table (which will be the same as the first row, if the table has only one column of type CHAR) to end with a semicolon, but other lines are not.
Here's a way to generate and execute such a dynamic script in SQL * more:
-Disable the features that make the output easy to read, but hinder the execution
SET FEEDBACK OFF
SET LINESIZE 500
SET PAGESIZE 0-Create fix_char.sql
COIL c:\some_pathename\fix_char.sqlSELECT THE CHECK BOX
WHEN ROW_NUMBER () OVER (PARTITION BY table_name
ORDER BY column_name
) = 1
THEN 'ALTER TABLE ' | table-name
|| "CHANGE (").
ELSE «»
END
|| column_name
|| "VARCHAR2 (').
|| DATA_LENGTH
|| ')'
|| CASE
WHEN ROW_NUMBER () OVER (PARTITION BY table_name
ORDER BY column_name DESC
) = 1
THEN '); "
Output END AS
Of user_tab_columns
WHERE data_type = "CHAR".
ORDER BY table_name
column_name
;SPOOL OFF
-Turn on the features that make the output easy to read, but hinder the execution
SET FEEDBACK ON
SET LINESIZE 80
SET PAGESIZE 50-Fix_char.sql performance
@c:\some_pathname\fix_charIt's good to change all the CHARIOT of VARCHAR2 columns. The CHAR data type is nothing trouble.
-
As of the 31 version, why is there still no option of Thunderbird to QUICKLY insert the date and time in the message that you write?
Literally, saw this option very well needed - and opportunity-"promise" for three years now, and even if there are only one or two formats that could be used, at least the option is there.
It seems that only is to bind a Macro, and the tool to Thunderbird and do it this way.
Joe Rotello
[email protected]
Skype: joerotelloIf the installation of the add-on of TimeStamp is unacceptable for see you if there is a related add-on that you that you already might have managed to convince author to add your function. The Add on more for example has many variables that can enter the body of the message that get automatically replaced with the appropriate data when you merge a message.
-
Insert the date the doc is modified or printed
Is it possible to insert the date of a document is modified or printed? The function insert time / Date does not work.
Thank you!
Dick
Pages is not a clone of Word and does not use the Word field codes. The answer is: no support for inserted date modified, or printed.
-
Insert the date and time in writing to the worksheet
Simple question here
I need save 4 data tables and insert the date and time at which it was taken (LV 8.6)
for example
04/09/09 10:00:01 4 6 7 2
04/09/09 10:00:02 4 6 7 2
04/09/09 10:00:03 4 6 7 2
04/09/09 10:00:04 4 6 7 2
Any ideas, I can't wire the right timestamp or date/time string in the table to create
Thank you
Chris
Someone there doing the same thing that I am, I got it to work with the attached VI.
-
Insert the date value in a table
Hello
I tried to update a table to insert the date in a date field. while I am running the query, it throws an error message like:
"
ORA-01830: date format picture ends before converting all of the input string
01830.00000 - "date format picture ends before converting all of the input string.
* Cause:
* Action:
"1830Error salesperson online: 1.
My update query is added under:
UPDATE PS_OBJCMTP_TMP SET LASTUPDOPRID = "PPLSOFT", LASTUPDDTTM = TO_DATE ('02-11 - 2002-12.14.09.000000 ',' YYYY-MM-DD - HH24.MI.) SS') WHERE OBJECTID1 = 3 AND OBJECTVALUE1 = 'EDIMAPPROPOP' AND OBJECTID2 = 0 AND OBJECTVALUE2 = '' AND OBJECTID3 = 0 AND OBJECTVALUE3 =' ' AND OBJECTID4 = 0 AND OBJECTVALUE4 = ' '
someone tell me how to solve this problem.Simply speaking, you should cut ' 2002 - 02 - 11 - 12.14.09.000000'-' 2002 - 02 - 11 - 12.14.09'.
RPAD('2002-02-11-12.14.09.000000',19) -
DECODE() using Insert the DATE field
I am trying to use the DECODE function to test for NULL before you insert a DATE field. However, it seems only to insert the DATE, with a time of 'default' from 12:00 - it is not inserted properly the time.
Basically, I need to test if Date1 is NULL. If not I need to concatenate the Date1 DATENT with TIME of Date2 to get a complete date/time... and then insert this new value.
Generic example:
-----
CREATE TABLE DATETEST (TestID NUMBER (1), DATE TestDate);
-----
DECLARE
DATE of v_Date1;
DATE of v_Date2;
BEGIN
v_Date1: = TO_DATE (1 Jan 11 05:53:12 ',' DD-MON-YY hh);
v_Date2: = TO_DATE (8 February 11 02:18:31 ',' DD-MON-YY hh);
INSERT IN DATETEST (TestID, TestDate) VALUES ('1', DECODE (v_Date1, NULL, NULL, TO_DATE (To_Char (v_Date1, 'DD-MON-YY') |))) ' ' || To_char(v_Date2, 'HH:mi:SS'), 'DD-MON-YY HH')));
INSERT IN DATETEST (TestID, TestDate) VALUES ('2', TO_DATE (To_Char (v_Date1, 'DD-MON-YY') |)) ' ' || To_char(v_Date2, 'HH:mi:SS'), 'DD-MON-YY HH'));
END;
-----
SELECT TestID, TO_CHAR (TestDate, ' DD-MON-YY hh) from DATETEST;
-----
The following example performs two inserts. With the DECODE function and the other without. One without inserts the time correctly. Can someone tell me why with the DECODE function do? I know I can use a simple if/then to check if the date is null above and put the time in a variable, but since my real scenario is in a lot of other things, I'm trying to keep it as simple as possible.
Published by: BoredBillJ on July 14, 2011 06:39INSERT INTO DATETEST( TestID, TestDate ) VALUES( 1, TRUNC(v_Date1) + (v_Date2 - TRUNC(v_Date2)) ) /
SY.
-
ADF progress indicator to insert the data into the file table.
I have a requirement where the progress bar should indicate the percentage of completion to insert the data into the tables of database files in a given folder path. I found an article that explains how to get the progress indicator when downloading a file in
http://www.gebs.ro/blog/Oracle/Oracle-ADF-progress-indicator-in-Fusion-Middleware-11g/. I believe that I must first get the total number of files in the folder and then begin to compare with the number of files that are inserted into the table similar to what is done by downloading (getting the file size and download size), but I don't know how to do this. Can anyone help?May be that this example allows you to
* 042. Dynamically change the color of progress bar based on its current value *.
http://www.Oracle.com/technetwork/developer-tools/ADF/learnmore/index-101235.html
-
Insert the date in a xslt mapping table
Hello
I have develop a BPEL process and I'm trying to insert the date system through BPEL in oracle table. I wrote what follows in the part of xsl to transform my file:
< xsl: Value-Select = "orcl:query - database (& quot; Select to_date (to_char(sysdate,'YYYY-MM-DD') | to_char (sysdate, 'hh24:mm:ss'),' YYYY-MM-name of the DDHH24:MI:SS of quot; () true, true (), & quot;jdbc:oracle:thin:sample_db/sample_db@localhost:80:XE & quot; dual) "/ >"
But the data are not implemented, I don't know what is the error. All answers are appreciated.
Thank you for your time and attention,
ChavignyYou are missing the T and he also like to use aliases for some reason any. Also is this port right, it shouldn't be 1521?
It is best to do this in the wizard as he places the escape to "(") character in the right place. "
Take a look at this post
http://forums.Oracle.com/forums/thread.jspa?threadID=892971&TSTART=25
You also have the option of the xp20:current-dateTime() of expression
see you soon
James -
Insert the date and time in a model of Pages 5,6
When I open one of the default templates provided with 5.6 Pages (for example, a letter), I noticed that the document opens with the current date correctly inserted. Yet when I create my own model and save it as a document template (if in my models or elsewhere) the date stamp is no longer up-to-date. Whenever I have create a new document from the template, it gets stuck on the date that I created the template. This means that I have to click on the date each time and select 'Set today' (it's easy to forget).
My understanding is that the inserted date stamps have is no longer an option of automatic update in Pages 5.x, so I was surprised to see their update automatically in the default templates provided with Pages. How Apple did this, and how do I get the same effect in my own registered designs?
Pages v5.6.2 and OS X 10.11.5.
I do not believe that something has changed with the way that Pages manages the dates that we insert into documents, or our new custom templates. The date will not automatically update for me when I create a new custom with a date of month template or a new document with a stamp of date/time in it. In both cases, wait 15 minutes, when I open it or the other, the date of the month in the model does not change and or don't have time in my document on my desktop.
It stays with v5.6.2 Pages, if you want a date automatically update a model, or in a document current/Sour, you need to use a single table cell, without borders, which is the date of formatting, and has a single equation: = now.
What I can not explain, for example, is the model of research paper that uses a date inserted regular field current date will appear automatically when opened for the first time in a new document. There are no tables in this model. There is no new parameters in v5.6.2 of Pages that can explain this behavior. This does not work for the user created templates. Pages could have been programmed to update only the date in the models grouped fields, but not user models - and if that were true, then it conforms to the demi-cuite nature in all of this application.
-
Script Automator for the DATE and TIME stamped record
Hi all
I'm not a scripter, but are in need of a DATE and time-STAMPED folder (or file) I would like to put on my desktop and have updated automatically so that I can use this tool to quickly see if a backup external (or internal) is current. probably I could also use it to quickly find out how /old/ a backup is.
for now, I do this manually if I want to quickly verify that a backup works by creating a "date named folder" on the desktop - such as '-2016 03 26 "."» so I can quickly see if a backup I just ran ran.
I have a lot of backups (internal, external, off site, etc.) and it would be super useful for me to have.
I consider the name of the folder to be customizable (potentially) in case I need to change it, but a good default would be "-YEAR MONTH DAY" so that I could see easily when this backup has been but also I name my files in this way so they can appear in chronological order "."
is anyone able to help me with something like that or suggest another forum for cross-post this?
Thank you
Jon
Hello
Create the the ""new folder " action, like this:"
---------------
Drag and drop the 'Shell Script' variable in the "name:" field.
--------------
Double click on the variable in the "name:" field:
Copy and paste this text in the field 'Script ':
date "+%Y %m %d"
-
MaxL Script to clear the data between two dates
Hi all
I need advice to clear the data between two dates, I have three dimensions in my sketch, 'eno', 'hiredate' and the 'actualamount '.
Now I need to erase the data between the date range, up to now, I have this script,
Fix ("HireDate", "Eno")
Difficulty (@relative ("00:00:00",0),@relative("eno",0)) 2015-07-15 "))
CLEARDATA "sal."
endfix
ENDFIX
These scripts only clears on a specific day, but I tried to write the script to clear between two dates, I surfed on a few sites, but no clear answers, finaanly came here, kindly help in this regard.
Thanks in advance.
Have you not tried the format of "startdate":"enddate" for example "August":"September."
See you soon
John
-
Insert the data in the table another table
Hi experts,
I am currently using the version below:
My requirement is to insert a table of data in the other table.Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production PL/SQL Release 11.2.0.1.0 - Production CORE 11.2.0.1.0 Production TNS for 32-bit Windows: Version 11.2.0.1.0 - Production NLSRTL Version 11.2.0.1.0 - Production
Table 1:
Table 2:create table a (a1 number); insert into a values (1); insert into a values (null); insert into a values (3);
I wrote the code to insert the lines below.CREATE TABLE c (b1 number not null); Note : table c have b1 column with not null constraint
He insert 1 row, then after I get the error message like: 01400. 00000 - "impossible to insert a NULL value in (%s)."declare v_a1 a.a1%TYPE; CURSOR c1 IS SELECT a1 FROM a; BEGIN OPEN c1; for i in 1..3 loop FETCH c1 INTO v_a1; EXIT WHEN c1%notfound; INSERT INTO c values(v_a1); commit; end loop; close c1; end;
But I want the output as:
Please give the solution to the prescription above.SELECT * FROM c; OUTPUT : 1 3
Thank youI think you are looking for DML ERROR LOGGING
SQL> desc a_tab Name Null? Type ----------------------------------------------------- -------- ------------------------------------ COL1 NUMBER COL2 NUMBER COL3 NUMBER COL4 NUMBER SQL> desc b_tab Name Null? Type ----------------------------------------------------- -------- ------------------------------------ COL1 NOT NULL NUMBER COL2 NOT NULL NUMBER COL3 NUMBER COL4 NUMBER SQL> execute dbms_errlog.create_error_log('b_tab', 'b_tab_err') PL/SQL procedure successfully completed. SQL> desc b_tab_err Name Null? Type ----------------------------------------------------- -------- ------------------------------------ ORA_ERR_NUMBER$ NUMBER ORA_ERR_MESG$ VARCHAR2(2000) ORA_ERR_ROWID$ ROWID ORA_ERR_OPTYP$ VARCHAR2(2) ORA_ERR_TAG$ VARCHAR2(2000) COL1 VARCHAR2(4000) COL2 VARCHAR2(4000) COL3 VARCHAR2(4000) COL4 VARCHAR2(4000) SQL> insert into b_tab(col1, col2, col3, col4) 2 select col1, col2, col3, col4 3 from a_tab 4 log errors into b_tab_err('my_test') reject limit unlimited; 2 rows created. SQL> select * from b_tab; COL1 COL2 COL3 COL4 ---------- ---------- ---------- ---------- 1 2 3 4 6 8 4 9 SQL> set serveroutput on SQL> SQL> exec dev_util.print_table('select * from b_tab_err') ------------------------------------------------------- Field Name Field Value ------------------------------------------------------- ORA_ERR_NUMBER$ : 1400 ORA_ERR_MESG$ : ORA-01400: cannot insert NULL into("ARBORU"."B_TAB"."COL2") ORA_ERR_ROWID$ : ORA_ERR_OPTYP$ : I ORA_ERR_TAG$ : my_test COL1 : 5 COL2 : COL3 : 3 COL4 : 6 ------------------------------------------------------- Field Name Field Value ------------------------------------------------------- ORA_ERR_NUMBER$ : 1 ORA_ERR_MESG$ : ORA-00001: unique constraint(ARBORU.SYS_C00658187) violated ORA_ERR_ROWID$ : ORA_ERR_OPTYP$ : I ORA_ERR_TAG$ : my_test COL1 : 1 COL2 : 9 COL3 : 9 COL4 : 0 PL/SQL procedure successfully completed. SQL>
-
How to insert the data from the table file?
I need to know that how can I insert data into multiple columns by file. I can simply insert data into a table of columns, but could not find a way to put the data in the column all.
My data in a file store
************************************************text.txt***************
133, nanny, nagina, 14 mph, 45637, 9156729863
**************************************************************my_data(table)**********
try to insert into table below...
Name, ID, last_name, add, PIN. Mob
*********************************************
Let me know if you need anything else... :))Hey nanny.
In fact, in SQL Developer, you can open a connection to the target schema, right-click on the Tables node in the Navigator tree, select import the data, then use the data import wizard. It is extremely flexible. Looks like you have a file of comma-separated variables, so if you select Format: csv and import method: Insert it will probably work fine.
To minimize the risk of errors during import, choose a limit value of preview so that the wizard can review the data type and the size of all columns in several lines of data as possible, and then examine the size/type of data for each column on the next page of the wizard and replace if necessary. For date columns, it is also important to choose the appropriate format mask.
Hope this helps,
Gary
SQL development team -
Doubt by inserting the Date and time in the table
Hi I created a table with two columns "Order_ID" and "Order_date" as
create table test
(
whole order_id,
ORDER_DATE date default sysdate
);
Now, I insert a line in the
insert into test (order_id) values (1);
now, I get the result as
ORDER_ID ORDER_DAT
------------- --------------
1 JUNE 5, 12
But I need to insert the time current system also in the Order_date column.
How can I achieve this?It works well for me!
bcm@bcm-laptop:~$ sqlplus user2/user2 SQL*Plus: Release 11.2.0.1.0 Production on Mon Jun 4 20:19:57 2012 Copyright (c) 1982, 2009, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options 20:19:58 SQL> @test1 20:20:01 SQL> create table test1 20:20:01 2 ( 20:20:01 3 order_id integer, 20:20:01 4 order_date date default sysdate 20:20:01 5 ); Table created. 20:20:01 SQL> 20:20:01 SQL> insert into test1(order_id) values(1); 1 row created. 20:20:01 SQL> select * from test1; ORDER_ID ORDER_DATE ---------- ------------------- 1 2012-06-04 20:20:01 20:20:01 SQL>
Maybe you are looking for
-
generation of sinusoidal wave with smu
Is it possible to generate, for example, one 3 a 50 Hz sine wave with SMU 4138 or 4139? THX
-
Best practices for the handling of data for a large number of indicators
I'm looking for suggestions or recommendations for how to better manage a user interface with a 'large' number of indicators. By big I mean enough to make schema-block big enough and ugly after that the processing of data for each indicator is added.
-
Hello IST is possible to set the coupling AC or just DC from the NI9219? Thank you
-
Update of cases in the structure of the case after having changed the 'Type of case.
Hello After you change the "Type of business" (only one case has been deleted), I discovered that in cases of strcuture cases has become "damaged": case "named" have been changed to digital small (that is, 0, 1, 2, 3). Is there a way to den strcuture
-
How can I retrieve e-mails deleted in windows live mail?
Can someone tell me how to retrieve emails that I deleted earlier today (09/24/11) in Windows Live Mail? Thank you!