Adding in Current date via SQL insert
If i am doing a process to update each line in a table, and i want to put in the current date into a column, is there a global variable that i can use.
FOR i in 1..HTMLDB_APPLICATION.G_F01.COUNT LOOP
UPDATE GFMIS.AUTOBAHNDIRECTACCOUNTS SET recert = '1', RECERTBY = :APP_USER, RECERT_ACTION = 'keep' , DATE = 'current date' WHERE ACCID = HTMLDB_APPLICATION.G_F01(i);
END LOOP;
So DATE would hold something like 10/18/2005 14:45
SYSDATE<br><BR>
FOR i in 1..HTMLDB_APPLICATION.G_F01.COUNT LOOP
UPDATE GFMIS.AUTOBAHNDIRECTACCOUNTS
SET recert = '1',
RECERTBY = :APP_USER,
RECERT_ACTION = 'keep' ,
DATE = SYSDATE
WHERE ACCID = HTMLDB_APPLICATION.G_F01(i);
END LOOP;<br>
chet
Similar Messages
-
How to Import data via SQL Loader with characterset UTF16 little endian?
Hello,
I'm importing data from text file into one of my table which contains blob column.
I've specified following in my control file.
-----Control file-------
LOAD DATA
CHARACTERSET UTF16
BYTEORDER LITTLE
INFILE './DataFiles/Data.txt'
BADFILE './Logs/Data.bad'
INTO TABLE temp_blob truncate
FIELDS TERMINATED BY " "
TRAILING NULLCOLS
(GROUP_BLOB,CODE)
Problem:
SQL Loader always importing data via big endian. Is there any method available using which we can convert these data to little endian?
ThanksA new preference has been added to customize the import delimiter in main code line. This should be available as part of future release.
-
A script for adding the current date to file name?
I am working in Indesign CS3. I frequently save file as PDFs into a designated folder. I was hoping for help in writing a script that would apply the current date to the end of the file name, when saved into this folder. Some days, I save the same file several times, into this folder. I was also hoping there was a way to add a date and version, for example "filename_2.25.11(1).pdf" Is this possible? Can someone help me?
ok, I ended up with this test routine:
on adding folder items to this_folder after receiving added_items
tell application "Finder"
repeat with this in added_items
my checkifopened(this)
display dialog (name of this) as text
end repeat
end tell
end adding folder items to
on checkifopened(this)
set a to POSIX path of (this as alias)
repeat until 1 = 0
## don't like that one because it relies on an error msg ... so
(** try
set b to do shell script "lsof | grep " & quoted form of a
on error
exit repeat
end try**)
##so I use this one
set b to do shell script "lsof"
if b does not contain a then
exit repeat
else
say "still opened"
end if
end repeat
end checkifopened
this is a folder action that tests if the added file is still opened by an application... there is no delay between each test-loop since lsof takes some time to execute...
And after adding a timeout (just in case) to this function the final script looks like this:
on adding folder items to thefolder after receiving added_items
tell application "Finder"
set folderkind to kind of thefolder
set myfiles to every item of thefolder whose name does not contain "#" and kind is not folderkind
repeat with myfile in myfiles
set myfile_datestring to my get_datestring(creation date of myfile)
set myfilename to name of myfile
if (count of every character of myfilename) > 4 and (character -4 of myfilename) as text is "." then
set filestatus to my checkifopened(myfile, 60)
if filestatus = false then
display dialog "timeout on folder action"
else
set tmp to ((characters 1 through -5 of myfilename) & "#" & myfile_datestring & (characters -4 through -1 of myfilename)) as text
set myfilename to my checknamewith_pdfsuffix(tmp, thefolder, false)
set name of myfile to myfilename
end if
end if
end repeat
end tell
end adding folder items to
on get_datestring(mydate)
return year of mydate & "-" & (characters -2 through -1 of (("0" & (month of mydate as integer)) as text)) & "-" & (characters -2 through -1 of (("0" & (day of mydate as integer)) as text)) as text
end get_datestring
on checknamewith_pdfsuffix(n, D, looped)
--check if filename exists in D
-- so if "A File.pdf" exists it names it "A File 1.pdf","A File 2.pdf",...
#n = string of the filename
#D = file reference to the directory to check
#looped = boolean used for recursive loop...
tell application "Finder"
set thefiles to name of every item of (D as alias)
end tell
if thefiles contains n then
if looped = false then
set n to ((characters 1 through -5 of n) & "(1)" & (characters -4 through -1 of n)) as text
my checknamewith_pdfsuffix(n, D, true)
else
set tmp to (last word of ((characters 1 through -5 of n) as text) as integer)
set tmpcount to (count of characters of (tmp as text)) + 5
set tmp to tmp + 1
set n to ((characters 1 through (-1 * tmpcount) of n) & "(" & tmp & ")" & (characters -4 through -1 of n)) as text
my checknamewith_pdfsuffix(n, D, true)
end if
else
return n
end if
end checknamewith_pdfsuffix
on checkifopened(this, mytimeout)
## this file reference
## timeout in seconds
set a to POSIX path of (this as alias)
set startdate to current date
repeat until 1 = 0
## don't like that one because it relies on an error msg ... so
(** try
set b to do shell script "lsof | grep " & quoted form of a
on error
exit repeat
end try**)
##so I use this one
set b to do shell script "lsof"
if b does not contain a then
return true
else if ((current date) - startdate) > mytimeout then
return false
else
##say "still opened"
end if
end repeat
end checkifopened
to use this save this script in /Library/Scripts/Folder Action Scripts
and add this as a folder action to your folder...
The script processes all files inside that folder each time a new files is added... -
SQL Developer - Adding a column comment via SQL
When I add a comment in SQL*Plus via SQL, such as COMMENT ON COLUMN "MY_OWNER"."MY_TABLE"."MY_COLUMN" IS 'column comment' it works fine. When I try the same thing in SQL Developer I receive a message "No SQL statement entered".
I realize this can be done in SQL Developer via action buttons in the user interface; but I need to be able to do it via SQL since my procedure generates this code for hundreds of columns at one time.
Is there a SQL way to do this in SQL Developer? Alternatively, can SQL Developer call SQL*Plus to run commands?This is a current bug when executing as statement (F9).
Good news is it does work when running as script (F5).
Have fun,
K. -
Inserting multiple rows into DB via SQL insert or stored procedure?
I have successfully created an application where I select a row in an output table view from a Microsoft Access DB SQL data source, and get an Oracle stored procedure to save the row in a new table in our Oracle DB.
This works like a charm when selecting one single row in the table view. What I really need though is for the procedure to save multiple rows at once.
My table is configured with selection mode = 'multiple', and the data mapping line between the table and my procedure has mapping scope = 'selected data rows'.
So, I am able to select multiple rows but still my procedure only stores one of the values sent. Does anyone know if this is related to my procedure not handling multiple parameter entries or if it's related to how VC outputs data to a procedure?
Here is output from runtime flex log where you see the three values: 3, 11 and 9 that is sent to the procedure's IN parameter 'P_ID'.
<Row OWNAPPS_TESTSQL_HYTTER_P_ID="3"/><Row OWNAPPS_TESTSQL_HYTTER_P_ID="11"/><Row OWNAPPS_TESTSQL_HYTTER_P_ID="9"/>
Please help
Henning Strand
I am still very, very interested in hearing if anyone has been successful at passing multiple rows to a stored procedure in one submit action.
Edited by: Henning Strand on Apr 11, 2008 1:58 PMUpdate for all you happy people using Oracle stored procedures with Visual Composer:
When trying to run a simple procedure that accepts arrays as input parameters, the JDBC connector returns an error message saying: 'PLS-00306: wrong number or types of arguments in call ...'
I registered this as a customer message with sap support and got an answer back saying:
Unfotunately our JDBC connector is still not able to work with SP that contain arrays, this is the reason for the behaviour that you're seeing.
This are the bad news, the good news is that with WebServices we don't have this limitation, so you can achieve the same results by using a WS instead of the Store Procedure.
I have asked if and when using stored procedures with arrays will be supported - waiting for answer.
Henning Strand -
Insert current date and time into Oracle date type field
I have a JDBC current date and time insert into Oracle 9i that almost works. It submits the current date and a fixed time into the Oracle date type field. I am using Tomcat 6.0.20.
For example if I insert the data at 7:24:04 PM on Feb 16, 2010 it will insert as: 16-Feb-2010 12:00:00 AM
The date part works but the time always shows 12:00:00 AM no matter what date or time the data is inserted.
Here is what I have for my JDBC inserts and I also tried something with DateFormat:
PreparedStatement ps; Date mydate = new Date(new java.util.Date().getTime()); //insert statement here.... stmt.setDate(1,mydate);
I also tried:
PreparedStatement ps; java.sql.Timestamp mydate = new java.sql.Timestamp(new java.util.Date().getTime()); SimpleDateFormat fmt = new SimpleDateFormat(.... //insert statement here.... ps.setTimestamp(1,fmt.format(mydate));
Both keep submitting the date into Oracle as 16-Feb-2010 12:00:00 AM
Anyway to get the current date and time? For example if I insert the data at 7:24.04 pm today it should show as 16-Feb-2010 07:24.04 PM in Oracle.sportsMarkr wrote:
Date mydate = new Date(new java.util.Date().getTime());Please see the javadocs for java.sql.Date and note the part that says "...to zero"
[http://java.sun.com/javase/6/docs/api/java/sql/Date.html]
If you want a date and time then use java.sql.Timestamp. -
How to get the "current date" in the BEx?
Hi all,
I need to get the "current date" in my Bex report in order to make a comparison. I know there is a "How to" which shows how to get the current date via a User Exit, but I didn't find it. Could you please help me?
Thanks1. Create a New Formula in Key Figures structure
2. Give tech name and description and Select "New variable" option
3. Next screen will launch Variable Wizard -> create a new variable with replacement path as processing type
4. in next screene select the date characteristic that represents the first date to use in the calculation (From Date)
5. In the next screen select Key in the Replace Variable with field. Leave all the other options as they are
6. In the next Currencies and Units screen select Date as the Dimension ID.
6. Save variable
repeate the Above steps to create another variable (To Date)
and now you can use these two new replacement path variables in your new formula.
Dev -
Hi,
i´d been searching for this for a long time but still don´t get it! how do i create a new object @universe level wich only delivers the current date or sysdate? i´d read a lot about SYSDATE but no change...
does the universe support objects that do not reference to a current object member but rather calculates the current date via MDX?
by the way a need to create such an object @universe, not within the bw query.
Thanks a lot for help.Hi,
Create an object date1 of type date.
In select clause,
dim_date.calendar_date
in where clause,
to_char(dim_date.calendar_date,'dd-mon-yyyy') = (select to_char(sysdate-1,'dd-mon-yyyy') from dual).
Hope this will solve your problem.
Acc to my knowledge, We can't use directly currentdate() function in universe.
This link may be help you:
http://www.gulland.com/wp/?p=18 -
Adding the Time to the current Date
Hi ,
I have a column where I have time stamp with date and time(8-May-10 10:20:55 Am) from that i will get only time(10:20:55 Am)[query for this mentioned below] Now i need to append the time to current date and insert into a Timestamps column only .
so my result should be 17-May-11 10:20:55 Am(Assuming current Date is 17-May-11) .
can any one please help because i am bugged up.
I tried search it by i found a way in sql server by using DataAdd and DataDiff .Its very urgent requirement for me.
Thanks in Advance
Regards
NikhilIs that really a timestamp datatype or is it a DATE datatype?
If it's a DATE datatype then something as simple as...
SQL> ed
Wrote file afiedt.buf
1 WITH t AS (SELECT to_date('8-May-10 10:20:55 Am','dd-mon-yy hh:mi:ss AM') timestmp FROM DUAL)
2 --
3 SELECT timestmp,
4 timestmp+(trunc(sysdate)-trunc(timestmp))
5* FROM t
SQL> /
TIMESTMP TIMESTMP+(TRUNC(SYSD
08-MAY-2010 10:20:55 18-MAY-2011 10:20:55
SQL>I personally would avoid using to_date(to_char.... as that involves too much datatype conversion. Oracle is perfectly good at doing date mathematics directly on DATE datatypes. -
Getting Current Date and using it in SQL
How do you get a current time and store it in a variable..
I am trying to make an a SQL query using it to search for all previous days appart from today.
ex:
currentDate = // store current date as a ShortDate into a variable
query = "SELECT * FROM Table WHERE < DATES "+currentDate+" ORDER BY Id"";Regarding prepared statement .
I am trying to insert the date into a variablelike
below.
String date = newjava.sql.Date(myDate.getTime());
I want allow me .... there really has to be a wayto
get a current System Date within java.That is because you have a lot of errors in that
line..
java.sql.Date now = new
java.sql.Date(System.currentTimeMillis());If you want it as a sql date object (date object in
sql doesn't have a time field, you need to use
Timestamp if you want date and time)
/Kajjava.sql.Date now = new java.sql.Date(new java.util.Date().getTime()); -
How to set defalut value to DB current date time in EO using sql
HI,
I am using below query to set default date time as DB current date
select to_char(sysdate, 'DD-MM-YYYY HH24:MI:SS') from dual
but it is throwing exception
(oracle.jbo.AttributeLoadException) JBO-27021: Failed to load custom data type value at index 7 with java object of type oracle.jbo.domain.Timestamp due to java.sql.SQLException.Halo,
I tested it & was able to find the values inserted in db in hiredate column.. What is that you did? Was this..
In EO of emp -- Hire date column of datatype timestamp :
details tab.. Default value -- expression :
DBTransaction.currentDbTimeIf you would have done this,
On run time when we click createInsert button , by default you will see the date.. After committing the changes, query it in db and will find the inserted record with default value..
Sample data i tested :
SQL Statement which produced this data:
select * from emp where empno=1111
EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO
1111,null,null,null,06/05/2013 17:18:41,4500,null,nullRegards,
Archana -
How do I insert the current date to hidden field?
I have a form for updating personal information. There is a field in the table called "dateupdated" that I would like to have on the form as a hiddent field that will automatically get the latest date (now).
Any idea's how I can set the hiddden field to current date?
Thanks, DennisYou don't need a hidden field to do that. Depending on the database you're using, you can either use a TIMESTAMP column (in MySQL) that is automatically updated, or you can use a SQL function to insert the current date.
For example, in PHP, you can use NOW() like this in a SQL query:
$insertSQL = sprintf("INSERT INTO date_test (created, message) VALUES (NOW(), %s)",
GetSQLValueString($_POST['message'], "text")); -
Insert current date/time and username into form.
Apologies for newbie question.
I have a form based on table Customer, within the table I have username and modifiedDate columns. How can I populate these text fields with the current user and current date/time ?
Thanks.Excellent, thanks for the fast response. I had this working and then tried in on a new form and now it fails to populate the desired fields.
I have created a process named "Insert date and username", Type P/SQL anonymous block. On Load - After Header, Once Per Page Visit.
select :APP_USER, to_char(SYSDATE,'DD-MON-YYYY HH24:MI:SS')
INTO :P16_USERNAME, :P16_MODIFIEDDATE
from dual;
Sorry for the hand holding!
Jason
Edited by: Jason S (UK) on Apr 24, 2013 6:57 AM -
As of version 31, why is there still no Thunderbird option to QUICKLY insert current date and time in message that you are writing?
Literally have seen this very-much-needed -- and used -- option "promised" for three years now, and even if there's only one or two formats that could be used, at least the option is there.
It seems only way is to link a Macro and tool to Thunderbird and do it that way.
Joe Rotello
[email protected]
Skype: joerotelloWhere was it promised? A quick search of Bugzilla didn't find a functionality request bug report for it.
I assume you're aware that Mozilla stopped development about 2 years ago (just adds security/stability fixes and provides infrastructure) and all new features and bug fixes are now added by the community. They seem pretty tied up with bug fixes and reworking some hard to maintain components such as the MIME support.
Have you tried the Timestamp add-on at https://addons.mozilla.org/en-us/thunderbird/addon/timestamp/ ? The version at AMO doesn't support versions later than 2.0 so you'd need to do something like install the disable add-on compatibility checks add-on at https://addons.mozilla.org/en-us/thunderbird/addon/checkcompatibility/?src=ss, and ignore the warning message about Timestamp not being compatible. However, the author has a version at http://extensions.sanjer.nl/?page=tb_ts that supposedly supports up to Thunderbird 11.9.x so it should be "compatible by default as it supports version 5 or later and is not a binary add-on like Lightning or Enigmail.
"For Thunderbird use the context menu (right click popup) in the compose window, Ctrl+Shift+T or "Options | Insert timestamp" to inserts the date/time into a message" -
Insert current date in ASP date/time field
I am trying to create an INSERT record in a database with a
field for the current date. I cannot fimd how to insert the date in
the field by using a default entry or SQL statement. How can I do
this using Dreamweaver for ASP pages? Thanks, JoeFor database server time, use GETDATE or CURRENT_TIMESTAMP in
your query.
For web server time, pass the value from Date() or Now().
"talk2perry" <[email protected]> wrote in
message
news:f4s2i1$3bu$[email protected]..
>I am trying to create an INSERT record in a database with
a field for the
> current date. I cannot fimd how to insert the date in
the field by using a
> default entry or SQL statement. How can I do this using
Dreamweaver for
> ASP
> pages? Thanks, Joe
>
Maybe you are looking for
-
Post Author: chretc CA Forum: Crystal Reports I am trying to show SalesPerson Commission on a report by Sales and Purchase Amounts. My data is in Excel, but we would like to use Crystal to write the report. I was able to use the SUMIF function in E
-
6500 classic missed call problem
Here´s another problem I have noticed: If I miss a call, see who the caller was and "redial" them the sound is all messed up (both the sound from and to the caller). It sounds like the voices go through a bucket and waterfall at the same time. Its im
-
MacMini and USB3 (USB2 Obsolete?)
Just purchased a new 2gHZ MacMini I have been reading that USB3 will soon be here to replace USB2 Since the current Macmini has USB2 ports will that make them obsolete when USB3 arrives? I presume the newest MacMini models when they are released will
-
Hi, I am trying to precompile a complete webapp containing about a hundred pages to be run isinde Tomcat 4.1. I was able to translate the pages with JSPC like this: jspc.bat -d c:/temp/jspcout -webapp c:/dev/webapps/myapp" Then I try to compile the r
-
Hi How can i print after end of list in alv. I have a list with columns like empcode(100),name(abc),gender(male),share(1) empcode(101),name(bcd),gender(male),share(1) empcode(102),name(eef),gender(female),share(1) empcode(102),name(ghi),gender(female