How to insert sysdate in 24hr format using select
hi,
I m just modifying my previous question
what if I have to insert the date using
insert into abc select sysdate from dual;
where abc is having one column sdate of type date.
this date inserted through the query to be inserted in 24hr
format.
a date is just a number, it doesn't have a format. so your
insert string will work. to see the time element in 24 hour
clock all you have to do is
select to_char (col1, 'DD-MON-YYYY HH24:MI:SS') from abc;
easy.
APC
Similar Messages
-
How to convert sysdate to the format dd-mon-yyyy
how to convert sysdate to the format dd-mon-yyyy
<how to convert sysdate to the format dd-mon-yyyy>
This question is better answered by thinking about about how Oracle dates work. SYSDATE is a pseudocolumn (function without any arguments) that returns a date value: it already is a date. Oracle date values are stored not as we see them, say 'DD-MON-YY', but as a series of bytes with the different date components from the millennium down to the second. We NEVER see dates as they are stored but use the formats for automatic conversion.
To display a date the way you want use TO_CHAR() with an edit mask or as others suggested change your NLS_DATE_FORMAT (thought I advise against this as most systems use DD-MON-YY and porting queries from other systems or even OTN can easily break). To change a converted string back to a date use TO_DATE() with an edit mask. -
How to print form into pdf format using smart forms in abap
please let me know how to print form into pdf format using smart forms in abap.
Moderator message: please search for available information/documentation.
Edited by: Thomas Zloch on Mar 25, 2011 2:04 PMHi ,
refer this link
<removed by moderator>
Regards,
Dhina..
Moderator message: please do not reply to questions that violate forum rules.
Edited by: Thomas Zloch on Mar 25, 2011 2:04 PM -
How to insert sysdate in a flat file
Hi All,
i have a interafce i extract data from oracle database and generate a flat file.
In one of the columns i have to insert sysdate in the file.
could someone help me how to add the sysdate in flat file.
Thanks in advance
NaveenHi Naveen,
Trying to contribute a little,
Yes you can use sunopsis CURRENT_DATE function to get the sysdate.
@ your interface
1. In the definition, make sure your staging area different from target is checked and SUNOPSIS MEMEORY ENGINE is selected.
2. In the diagram, for the column which you want date to be inserted just say CURRENT_DATE and make it to execute on STAGING.
3. In the Flow, you have to see 3 boxes, in the first box select LKM SQL to SQL, in the second box make it as UNDEFINED, in the third box select IKM SQL To FIle Append and select the options accordingly.
Makes sens?
Thanks,
G -
How to insert date into a table by selecting form sysdate
Hi
My Table format is like this
SQL>desc log;
Name Null? Type
EMP_ID VARCHAR2(30)
LOGIN DATE
LOGOUT DATE
now when ever an employee logs in i w'd like to insert date into the table.
i put up the following query
SQL> insert into log(emp_id,login)
2 values
3 ('Ed_01',
4 select
5 sysdate
6 from dual
7 );
select
ERROR at line 4:
ORA-00936: missing expression
I got the above error how can i rectify that plz suggest me very urgently as i have to submit my project very early to my boss.try this :
insert into log(emp_id,login) values ('Ed_01', sysdate); -
How to send mail in HTML format using SMTP
I want to send mail in HTML format using SMTP.Can anybody please suggest how to do it.Can anybody send me the code.
Thnx.If you don't know how to send a message using JavaMail see here : http://developer.java.sun.com/developer/onlineTraining/JavaMail/contents.html#JavaMailSending
To send a html format mail you need to set the content type like this (msg is a javax.mail.internet.MimeMessage) :
String subject = "An Email 4 U";
String message = "<HTML><BODY>Here is a link<br><a href='http://javasoft.com'>Java</a></BODY></HTML>";
msg.setSubject(subject);
msg.setContent(message, "text/html");p.s This isn't really an advanced topic -
How to insert more than 12 items using BDC for MB1C
Hi,
When we use LSMW for data transfer of MB1C transaction, more than 12 items can be inserted in a document.
But using BDC only 12 and below is possible, if the flat file system has more that 12 item, then the document is not created.
How to insert more than 12 item in a document.
RegardsHi Gow,
I have uploaded the MB1C through a BDC and it is working fine for n no of items.
Here is the code. May be this will be of your help.
*& Report ZMB1C
report ZMB1C
no standard page heading line-size 255.
type-pools : slis.
tables : t100.
data: begin of record,
MATNR(018),
ERFMG(017),
EXBWR(016),
end of record.
data : itab like table of record with header line.
data : w_bdcdata type bdcdata.
data : t_bdcdata type standard table of bdcdata initial size 1.
data : messtab type standard table of bdcmsgcoll with header line.
data : mstring(300).
data : vf_index type i,
no_lines type i,
count type i value 0.
data : v_bldat(20),
v_budat(20).
*Excel Sheet Data Upload Details
data : vf_start_col type i value '1', "start column
vf_start_row type i value '2', "start row
vf_end_col type i value '100', "maximum column
vf_end_row type i value '10000'. "maximum row
*/ Internal Table For Excel Data
data : it_excel type kcde_cells occurs 0 with header line.
*/ Field symbol
field-symbols : <fs>.
data : begin of it_messtab occurs 0,
plant(10) type c,
status(10) type c,
message(90) type c,
end of it_messtab.
*Data for ALV display
data : wa_fcat type slis_fieldcat_alv,
colcnt type i.
data : it_fieldcat type slis_t_fieldcat_alv,
i_events type slis_t_event.
data : l_title type sychar70.
data : l_repid like sy-repid.
* Selction Screen
selection-screen begin of block b1 with frame title text-000.
parameters : p_file like ibipparms-path obligatory,
p_mode like ctu_params-dismode default 'A'.
selection-screen end of block b1.
selection-screen begin of block b2 with frame title text-001.
parameters : p_bldat like MKPF-BLDAT obligatory,
p_budat like MKPF-BUDAT obligatory,
p_bwart like RM07M-BWARTWA obligatory,
p_werks like RM07M-WERKS obligatory,
p_lgort like RM07M-LGORT obligatory.
selection-screen end of block b2.
* At Selction Screen
at selection-screen on value-request for p_file.
call function 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name = ''
IMPORTING
file_name = p_file.
*Start of Selection Event
start-of-selection.
call function 'KCD_EXCEL_OLE_TO_INT_CONVERT'
EXPORTING
filename = p_file
i_begin_col = vf_start_col
i_begin_row = vf_start_row
i_end_col = vf_end_col
i_end_row = vf_end_row
TABLES
intern = it_excel
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
others = 3.
if sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
if it_excel[] is initial.
MESSAGE I000(ZCL_TCSABAP).
else.
sort it_excel by row col.
loop at it_excel.
move : it_excel-col to vf_index.
assign component vf_index of structure itab to <fs>.
move : it_excel-value to <fs>.
at end of row.
append itab.
clear itab.
endat.
endloop.
endif.
if not itab[] is initial.
DESCRIBE TABLE itab LINES no_lines.
clear messtab.
refresh messtab.
CONCATENATE p_bldat+6(2) '.' p_bldat+4(2) '.' p_bldat(4) into v_bldat.
CONCATENATE p_budat+6(2) '.' p_budat+4(2) '.' p_budat(4) into v_budat.
perform map_rec.
call transaction 'MB1C' using t_bdcdata mode p_mode update 'A'
messages into messtab .
clear t_bdcdata.
refresh t_bdcdata.
loop at messtab where msgtyp = 'E' or msgtyp = 'S' .
select single * from t100 where sprsl = messtab-msgspra
and arbgb = messtab-msgid
and msgnr = messtab-msgnr.
if sy-subrc = 0.
mstring = t100-text.
if mstring cs '&1'.
replace '&1' with messtab-msgv1 into mstring.
replace '&2' with messtab-msgv2 into mstring.
replace '&3' with messtab-msgv3 into mstring.
replace '&4' with messtab-msgv4 into mstring.
else.
replace '&' with messtab-msgv1 into mstring.
replace '&' with messtab-msgv2 into mstring.
replace '&' with messtab-msgv3 into mstring.
replace '&' with messtab-msgv4 into mstring.
endif.
condense mstring.
it_messtab-message = mstring(300).
it_messtab-plant = p_werks.
if messtab-msgtyp = 'E'.
it_messtab-status = 'Error'.
else.
it_messtab-status = 'Success'.
endif.
append it_messtab.
clear it_messtab.
endif.
endloop. "messtab
if not it_messtab[] is initial.
perform buildcatalog.
perform display.
endif.
endif.
*& Form Map_Rec
* text
form map_rec.
perform bdc_dynpro using 'SAPMM07M' '0400'.
perform bdc_field using 'BDC_CURSOR'
'RM07M-WVERS3'.
perform bdc_field using 'BDC_OKCODE'
'NPE'.
perform bdc_field using 'MKPF-BLDAT'
v_bldat.
perform bdc_field using 'MKPF-BUDAT'
v_budat.
perform bdc_field using 'RM07M-BWARTWA'
p_bwart.
perform bdc_field using 'RM07M-WERKS'
p_werks.
perform bdc_field using 'RM07M-LGORT'
p_lgort.
perform bdc_field using 'XFULL'
perform bdc_field using 'RM07M-XNAPR'
'X'.
perform bdc_field using 'RM07M-WVERS2'
perform bdc_field using 'RM07M-WVERS3'
'X'.
loop at itab.
count = count + 1.
perform bdc_dynpro using 'SAPMM07M' '0410'.
perform bdc_field using 'BDC_CURSOR'
'MSEG-EXBWR'.
if count <> no_lines.
perform bdc_field using 'BDC_OKCODE'
'=NPE'.
elseif count = no_lines.
perform bdc_field using 'BDC_OKCODE'
'=BU'.
endif.
perform bdc_field using 'MSEG-MATNR'
itab-MATNR.
perform bdc_field using 'MSEG-ERFMG'
itab-ERFMG.
perform bdc_field using 'MSEG-EXBWR'
itab-EXBWR.
endloop. "itab
endform. "Map_Rec
** Form BDC_DYNPRO
form bdc_dynpro using program dynpro.
clear w_bdcdata.
w_bdcdata-program = program.
w_bdcdata-dynpro = dynpro.
w_bdcdata-dynbegin = 'X'.
append w_bdcdata to t_bdcdata.
endform. "bdc_dynpro
** Form BDC_FIELD
form bdc_field using fnam fval.
if fval <> space.
clear w_bdcdata.
w_bdcdata-fnam = fnam.
w_bdcdata-fval = fval.
append w_bdcdata to t_bdcdata.
else.
clear w_bdcdata.
w_bdcdata-fnam = fnam.
w_bdcdata-fval = fval.
append w_bdcdata to t_bdcdata.
endif.
endform. "bdc_field
* FORM buildcatalog *
form buildcatalog.
clear wa_fcat.
clear it_fieldcat.
colcnt = colcnt + 1.
wa_fcat-col_pos = colcnt.
wa_fcat-fieldname = 'PLANT'.
wa_fcat-tabname = it_messtab.
wa_fcat-seltext_l = 'PLANT'.
wa_fcat-key = 'X'.
wa_fcat-outputlen = '10'.
append wa_fcat to it_fieldcat.
clear wa_fcat.
colcnt = colcnt + 1.
wa_fcat-col_pos = colcnt.
wa_fcat-fieldname = 'STATUS'.
wa_fcat-tabname = it_messtab.
wa_fcat-seltext_l = 'STATUS'.
wa_fcat-outputlen = '10'.
append wa_fcat to it_fieldcat.
clear wa_fcat.
colcnt = colcnt + 1.
wa_fcat-col_pos = colcnt.
wa_fcat-fieldname = 'MESSAGE'.
wa_fcat-tabname = it_messtab.
wa_fcat-seltext_l = 'Message'.
wa_fcat-outputlen = '90'.
append wa_fcat to it_fieldcat.
endform. "buildcatalog
* FORM display *
form display.
l_title = text-002.
l_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = l_repid
i_grid_title = l_title
it_fieldcat = it_fieldcat
it_events = i_events[]
TABLES
t_outtab = it_messtab
EXCEPTIONS
program_error = 1
others = 2.
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endform. "display
Regards,
Amit -
How to insert data into BLOB column using sql
Hi all,
How to insert data into BLOB column directly using sql .
create table temp
a blob,
b clob);
SQL> /
Insert into temp values ('32aasdasdsdasdasd4e32','adsfbsdkjf') ;
ERROR at line 1:
ORA-01465: invalid hex number
Please help in this.Thanks,
P Prakashsee this
How to store PDF file in BLOB column without using indirect datastore -
How to pass parameter in Function by using select statement?
Hi,
I got a problem. I cant pass in parameter to function by using select statement. But it can pass in parameter by using 'hardcode' method. How can I solve this problem?
Eg,
select * from table (SplitFunction('HS750020,HS750021')) <<< this work.
but
select * from table (SplitFunction(select LOT_NO from TRACER_SEARCH_SCHEDULE where JOB_ID = '36')) <<< do not work.
Thanks for who try to help. Thanks.skymonster84 wrote:
I have try this before. But it not work.here is an example
create or replace type stringlist as table of varchar2(100)
create or replace function splitstring(pstring in varchar2) return stringlist
as
lstringlist stringlist;
begin
select regexp_substr(pstring,'[^,]+',1, level) bulk collect into lstringlist
from dual
connect by level <= length(pstring)-length(replace(pstring,','))+1;
return lstringlist;
end;
select * from table(select splitstring('xx,yy,zz') from dual)
create table t(str varchar2(100))
insert into t values('x,y,z')
insert into t values('a,b,c')
select * from table(select splitstring(str) from t where rownum<2)
/If you supply multiple values then it will fail.
select * from table(select splitstring(str) from t)
/ -
How to insert characters into a file using Labview
I have collected acoustic data that I am turning into wav files. After the collection, I now know the file size and need to insert the wav file header on top of this file. Can anyone tell me how to concatenate two files, or insert the wav header (string) data into the other file? My current method is very inefficient. The collected data file can become extremely large, so I am trying to avoid reading this file. I would rather poke data into it without overwriting any existing data. Thanks in advance.
hello
See attached vi. It is a modification of NI warite wav vi. It only writes header. So Write a default header, append your data and write heder again using the number of bytes of audio.
Hope this helps.
"Qod natura non dat, Salmantica non praestat"
Attachments:
Cabecera_Wav.vi 77 KB -
How to inserted cells and keep formatting, copy formulas.
Hi- I used to use Excel in the late 90's and am using Appleworks 6.2.9. Here are my problems that I cannot solve:
I have an invoice with borders and SUM formulas. How do I insert new cells while maintaining both?
With Excel I could click on a cell with a SUM formula, then drag down a few rows and release, which would copy the formulas into those cells. I cannot find a way to do this simply.
Any light you can shed would be greatly appreciated. I'm trying to save money on programs and use what I have.
iMac G5 Mac OS X (10.3.9)
iMac G5 Mac OS X (10.3.9)Great, thanks, that helped w/ the autofill.
I still need advice on inserting cells that have the same borders and would be entered into the total columns in my invoice. The idea would be to be able to add rows, drop the data down, and not have to reformat any of the SUM cells or borders.
Thanks! -
How to insert into DB in batches using XSU
Hello,
I am inserting data from xml files into different tables .I have got four queries .I want to inert them using batch so that if in any query exception is raised,then whole thing is rollback.
Thanks in advance for any help.Hi Linda,
Yes, it makes sense to do it this way... Otherwise there are lots of complications related to calling an insert statement or plsql pkg from code.
Questions:
1) Can anybody please paste dummy code to be written in AM?
2) How to add "AM Commit" from data controls to bindings? (When I click on the + button on my page definition select action it doesn't show 'Commit')
(The only way to add this action is by drag it and drop it as a button)
(How can I override action listener for this button since it would be #{bindings.Commit.execute})
(I am planning to add all my logic to collect attributes, insert in VO and execute commit in one button)
Thanks
Rahul -
How to insert huge XML in CLOB using insert command in sql*plus....
How to upload huge XML into a CLOB column of a normal table using a script?
A simple insert statement does not seem to work.
Thanks & regards.In SQL *Plus i'm trying to insert directly into the table.
My insert statement is like below :
Insert into ui_templates
(TEMPLATE_ID, TEMPLATE_NAME, CUSTOMER_ID, DESCRIPTION, XML_CONTENT)
Values
(1, 'Default', 1, 'Main Default Template', '<?xml version="1.0" encoding="utf-8"?><xoraLayout:Layout name="MyLayout" version="1.0" ................<3357> chars long');
COMMIT;
Message was edited by:
DKar -
Hi all,
In my SQL Server 2012 Management Studio (SSMS2012), I tried to create a Database (MacLochainnsDB) and a dbo Table (marvel). then I wanted insert 8 VALUES into the Table by using the following code:
USE master
IF EXISTS
(SELECT 1
FROM sys.databases
WHERE name = 'MacLochlainnsDB')
DROP DATABASE MacLochlainnsDB
GO
CREATE DATABASE MacLochlainnsDB
GO
CREATE TABLE [dbo].[marvel] (
[avenger_name] [char] (30) NULL)
INSERT INTO marvel
(avenger_name)
VALUES
('Hulk', 1),
('Iron Man', 2),
('Black Widow', 3),
('Thor', 4),
('Captain America', 5),
('Hawkeye', 6),
('Winter Soldier', 7),
('Iron Patriot', 8)
I got the following error Message:
Msg 110, Level 15, State 1, Line 5
There are fewer columns in the INSERT statement than values specified in the VALUES clause. The number of values in the VALUES clause must match the number of columns specified in the INSERT statement.
How can I correct this problem?
Please kindly help and advise.
Thanks in advance,
Scott Chang
P. S.
The reason I tried to create the Database, dbo Table, and then to insert the VALUES is to learn the following thing:
You can query the entire node tree with the following xquery statement because it looks for the occurrence of any node with the /* search string:
DECLARE @x xml;
SET @x = N'<marvel>
<avenger_name>Captain America</avenger_name>
</marvel>';
SELECT @x.query('/*');
You can query the avenger_name elements from the marvel_xml table with the following syntax:
SELECT xml_table.query('/marvel/avenger_name')
FROM marvel_xml;
It returns the following set of avenger_name elements:
<avenger_name>Hulk</avenger_name>
<avenger_name>Iron Man</avenger_name>
<avenger_name>Black Widow</avenger_name>
<avenger_name>Thor</avenger_name>
<avenger_name>Captain America</avenger_name>
<avenger_name>Hawkeye</avenger_name>
<avenger_name>Winter Soldier</avenger_name>
<avenger_name>Iron Patriot</avenger_name>
You can query the fourth avenger_name element from the marvel_xml table with the following xquery statement:
SELECT xml_table.query('/marvel[4]/avenger_name')
FROM marvel_xml;
It returns the following avenger_name element:
<avenger_name>Thor</avenger_name>Hi Scott,
The master database records all the system-level information for a SQL Server system, so best practise would be not to create any user-defined
object within it.
To change your default database(master by default) of your login to another, follow the next steps so that next time when connected you don't have to use "USE dbname" to switch database.
Open SQL Server Management Studio
--> Go to Object explorer(the left panel by default layout)
--> Extend "Security"
--> Extend "Logins"
--> Right click on your login, click "propertites"
--> Choose the "Default database" at the bottom of the pop-up window.
--or simply by T-SQL
Exec sp_defaultdb @loginame='yourLogin', @defdb='youDB'
Regarding your question, you can reference the below.
SELECT * FROM master.sys.all_objects where name ='Marvel'
--OR
SELECT OBJECT_ID('master.dbo.Marvel') --if non empty result returns, the object exists
--usually the OBJECT_ID is used if a if statement as below
IF OBJECT_ID('master.dbo.Marvel') IS NOT NULL
PRINT ('TABLE EXISTS') --Or some other logic
What is the sys.all_objects? See
here.
If you have any question, feel free to let me know.
Eric Zhang
TechNet Community Support -
How to insert sysdate with associated time
I want to insert a record into a date field with yesterday dates (sysdate-1) plus time 23:59:59. Any idea on how to do this? I have tried a couple of things but so far no luck.
Any help would be greatly appreciated.
Thank you.HI,
You can try this.
SQL> CREATE TABLE T1 (FLD1 DATE);
Table created.
SQL> INSERT INTO T1 VALUES(SYSDATE-1) ;
1 row created.
SQL> SELECT * FROM t1;
FLD1
02-MAY-07
SQL> SELECT fld1 , TO_CHAR(fld1, 'MON/DD/YYYY HH:MI:SS') FROM T1;
FLD1 TO_CHAR(FLD1,'MON/DD
02-MAY-07 MAY/02/2007 01:08:49
SQL>
Thanks
Maybe you are looking for
-
If you want to understand 64-bit and 32-bit, click here.
This is a great read on the subject. http://www.appleinsider.com/articles/08/08/26/roadto_mac_os_x_10_6_snow_leopard_64bits.html
-
Dear Experts I have 2 restricted key figures both set with aggregation level Total with reference to a characteristic. both are with reference to different characteristics. KF 1 is a formula containing KF 2 . So, the referred characteristics are Cha
-
Diff in IAS 9i Form Service Version and Developer 6i Rel 2. Version
Dear all, I have noticed that Form Server version which comes with the Oracle 9i Application Server (Forms Service Module) is higher than then Oracle Developer 6i Tool Rel. 2 Form Complier version. It Creates a problem, Form which is complied in Deve
-
Form with variable length pages
Hi, I have a form which has categories of data - some categories require many fields and some require only a handful of fields. I want to put each category on a single page. My Master Page has a graphic which serves as a background for all of the pag
-
Adobe Captivate 6 trial - installation failure
I just downloaded the CP 6 demo and when I went to run the installer I got this message: "Installation failed The product you are trying to install is not an Adobe Genuine Software and appears to be counterfeit. Please report piracy or contact custom