How to insert date with timestamp into table values
hi,
I have a table
create table abc1(dob date);
insert into abc1 values (to_date(sysdate,'RRRR/MM/DD HH24:MI:SS'))
but when i see in data base it shows as normal date without time stamp.
Is it possible to insert into back end with timestamp.
Thanks..
First, SYSDATE is a DATE already, no need to convert it to a DATE using the TO_DATE() function.
The date ALWAYS has a time component, whether or not it is displayed is up to your NLS settings. for example:
SQL> CREATE TABLE ABC1(DOB DATE);
Table created.
SQL> ALTER SESSION SET NLS_DATE_FORMAT='MM/DD/YYYY';
Session altered.
SQL> INSERT INTO ABC1 VALUES(SYSDATE);
1 row created.
SQL> SELECT * FROM ABC1;
DOB
02/04/2010
SQL> ALTER SESSION SET NLS_DATE_FORMAT='MM/DD/YYYY HH24:MI:SS';
Session altered.
SQL> SELECT * FROM ABC1;
DOB
02/04/2010 12:54:57
SQL> DROP TABLE ABC1;
Table dropped.
Similar Messages
-
How to insert data from different internal table into a data base table
hi all,
I want to insert a particular field in an internal table to a field in a data base table.Note that the fields in the internal table and database table are not of the same name since i need to insert data from different internal tables.can some one tell me how to do this?
in short i want to do something like the foll:
INSERT INTO ZMIS_CODES-CODE VALUE '1'.
*INSERT INTO ZMIS_CODES-COL1 VALUE DATA_MTD-AUFNR .(zmis_codes is the db table and data_mtd is the int.table)REPORT ZINSERT.
tables kna1.
data: itab LIKE KNA1.
data lv_kUNAG LIKE KNA1-KUNNR.
lv_kuNAG = '0000010223'.
ITAB-kuNNR = lv_kuNAG.
ITAB-name1 = 'XYZ'.
INSERT INTO KNA1 VALUES ITAB.
IF SY-SUBRC = 0.
WRITE:/ 'SUCCESS'.
ELSE.
WRITE:/ 'FAILED'.
ENDIF.
Here lv_kunag is ref to kna1 kunnr passed in different name
In internal table .
Try and let me know if this logic dint work. -
How to insert data from file to table??
I need to know that how can i insert data in multiple column through file. I can simply insert data in one column table but couldnt find out the way to put data in all column.
My data store in a file
************************************************text.txt***************
133, shailendra, nagina, 14/H, 45637, 9156729863
**************************************************************my_data(table)**********
trying to insert into below table...
id, name, last_name, add, pin. mob
Let me know if anything else needed..:)Hi Shailendra,
Actually, in SQL Developer, you can open a connection to the target schema, right-click on the Tables node in the navigator tree view, select Import Data, then use the Data Import Wizard. It is extremely flexible. It looks like you have a comma separated variable file, so if you select Format: csv and Import Method: insert it will probably work just fine.
To minimize the chance of errors during import, pick a preview limit value so the wizard can examine the size and data type of all columns in as many data rows as possible, then review the data type/size for each column in the next wizard page and override as necessary. For date columns it is also important to choose the appropriate format mask.
Hope this helps,
Gary
SQL Developer Team -
How to Insert data from notepad to Table
Hi,
I have one table with nodata.i need to insert data into table.but i have records in one notepad.if i enter manually
like using insert statement it will take more time.
Any one know insert data from notepad to table or i need sql script that will use for all the records.Here im using sqldeveloper.Hi dude,
We can use below 2 types.
1) Sql loader
2) utl file
SQL*Loader utility?
One can load data into an Oracle database by using the sqlldr (sqlload on some platforms) utility. Invoke the utility without arguments to get a list of available parameters. Look at the following example:
sqlldr username@server/password control=loader.ctl
sqlldr username/password@server control=loader.ctlThis sample control file (loader.ctl) will load an external data file containing delimited data:
load data
infile 'c:\data\mydata.csv'
into table emp
fields terminated by "," optionally enclosed by '"'
( empno, empname, sal, deptno )
{code}
The mydata.csv file may look like this:
{code}
10001,"Scott Tiger", 1000, 40
10002,"Frank Naude", 500, 20
{code}
Optionally, you can work with tabulation delimited files by using one of the following syntaxes:
{code}
fields terminated by "\t"
fields terminated by X'09'
{code}
Additionally, if your file was in Unicode, you could make the following addition.
{code}
load data
CHARACTERSET UTF16
infile 'c:\data\mydata.csv'
into table emp
fields terminated by "," optionally enclosed by '"'
( empno, empname, sal, deptno )Another Sample control file with in-line data formatted as fix length records. The trick is to specify "*" as the name of the data file, and use BEGINDATA to start the data section in the control file:
load data
infile *
replace
into table departments
( dept position (02:05) char(4),
deptname position (08:27) char(20)
begindata
COSC COMPUTER SCIENCE
ENGL ENGLISH LITERATURE
MATH MATHEMATICS
POLY POLITICAL SCIENCEPlease refer the below link.. it will useful for you.
http://psoug.org/reference/sqlloader.html
http://docs.oracle.com/cd/B10500_01/server.920/a96652/ch05.htm
Regards,
N.Senthil. -
How to insert data from site into DB?
Hi
Does anyone know how to insert data into a database from a
website?
I have created a Registration form for users to register to
my web site. With this I would like the data they have entered to
be stored in a MySQL database. I have created the a form and used
the record insertion form wizard.
When they have registered, I need to be able to check their
username every time they log in.
If anyone could help, it would be greatly appreciated,
thanks Lou.LoobieLouLou wrote:
> When I inserted a form, I enetered a name and the method
was POST, but it also needed an action.
> How do I write in java script that it needs to be
inserted into the database?
You can't do it with JavaScript. You need to use a
server-side language
like ASP, ASP.NET, ColdFusion, or PHP. Dreamweaver automates
a lot of
the process for you, but you need to choose your server model
first.
It sounds as though you are completely new to this. First ask
your
hosting company whether it supports a server-side language,
and if so,
which one. Then open Dreamweaver help (F1) and read the
section titled
"Preparing to Build Dynamic Sites".
Working with server-side languages and databases isn't
difficult, but
it's not something you can pick up in five minutes or be
shown how to do
in a couple of forum posts.
If you can't make up your mind which server-side language to
use,
ASP.NET is the most difficult of the four I mentioned. ASP is
popular,
but is no longer actively developed, so will eventually die
out
(although it will take many years to do so). ColdFusion and
PHP are
relatively easy to learn. I prefer PHP, but all of them do
basically the
same thing. However, you must choose one; they cannot be
mixed.
David Powers, Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/ -
How to insert data with & into table..
Hi,
i want to insert following data to table
sql>insert into emp values('company & co');
Enter value for co:
how to avoid this ?You should disable the interactive prompt in SQL Plus. How to do check this link
http://www.orafaq.com/wiki/SQL*Plus_FAQ#How_does_one_disable_interactive_prompting_in_SQL.2APlus.3F -
urgent insert Date with Time into Access Database
i found the following codes from the forum to insert date into microsoft access database:
java.sql.Date date = new java.sql.Date((new java.util.Date()).getTime())
stmt.executeUpdate("INSERT INTO Testing " +"VALUES (#"+date+"#)");
but i need to insert the date together with its time so may i know how can i do it?thanks alot i works... but it allow only one value to be inserted.
so i try the codes below:
Timestamp ts=new Timestamp(tryDate.getTime());
PreparedStatement p = connection.prepareStatement("insert into testing values(?,?)");
p.setTimestamp(1,ts);
p.setString(2,theMsg.getContent());
p.executeUpdate();
and error is this:
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Number of query values and destination fields are not the same.
at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6106)
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:6263)
at sun.jdbc.odbc.JdbcOdbc.SQLExecute(JdbcOdbc.java:2564)
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.execute(JdbcOdbcPreparedStatement.java:214)
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.executeUpdate(JdbcOdbcPreparedStatement.java:136)
at DBIncomingQueue.insertMessage(DBIncomingQueue.java:84)
at DBIncomingQueue.main(DBIncomingQueue.java:213) -
How to insert data in to database table depends on Indicator
Hi All,
I am working on Idoc to JDBC scenario. I am collecting & bundling(Using BPM) all the idocs and inserting the data in to the different database tables. Up to now my scenario is working fine. Now the problem is before inserting the data I have to check one of the Table field. If the field indicator is u201CYESu201D then only I have to insert data otherwise I have to wait up to the indicator field needs to be changed. Once indicator is u201CYESu201D then I have to insert all the collected idocs in to the database tables.
Can you please let me know how can I achieve this?
Thanks & Regards,
PurushothamHi,
There are two ways you can achieve this.
1. Instead of directly calling SQL statements write a stored procedure on database which will have first select query and then based on its result fire the insert query.For processing any logic like this stored procedure is the best approach. You can call SP from your jdbc receiver channel
2. By using a BPM. In this case you have to first fire a select query in the database and based on the response from database, fire the insert statement from bpm only. basically you will be having 2 send steps to database. One with Select statement and another with insert statement. You need to handle your logic in BPOM in this case.
Hope this answers your question.
Thanks
Amit -
How to insert data in nested ref table
hi i am having some problems i am trying to insert data into a table that has a ref and is nested can some one please help me.
Now this is the problem tring to insert data in manfs when it is already a ref and a nested table
Can someone please tell me the correct way to insert data
via Home>SQL>SQL Commands or another way if easier.
INSERT INTO TABLE (
SELECT c.CustName
FROM Customer_objtab c
WHERE c.CustName = 'Edward Teach'
VALUES (1,
BeerTableType(
BeerType2(‘pride’,’ale’,’yellow’),
below are the other tables i have created so far;
----------------------This is my tbale-------------------------
CREATE TYPE Customer_objtyp AS OBJECT (
CustNo NUMBER,
CustName VARCHAR2(200),
Address_obj Address_objtyp,
PhoneList_var PhoneList_vartyp,
) NOT FINAL;
------------------this is my subtype of customer----------------------
CREATE TYPE Corp_Customer_objtyp UNDER Customer_objtyp
(account_mgr_id NUMBER(6) ) NOT FINAL;
CREATE TYPE BeerType2 AS OBJECT (
nameCHAR(20),
kindCHAR(10),
colourCHAR(10));
CREATE TYPE BeerTableTypeAS
TABLE OF BeerType2;
CREATE TABLE manfs(
age number,
Cust_ref REF Customer_objtyp,
beers BeerTableType,
copy number)
NESTED TABLE beers STORE AS BeerTable;Dear user!
Please modify your code like that:
CREATE TYPE Customer_objtyp AS OBJECT (
CustNo NUMBER,
CustName VARCHAR2(200),
Address_obj Address_objtyp,
PhoneList_var PhoneList_vartyp,
) NOT FINAL;
CREATE TYPE Corp_Customer_objtyp UNDER Customer_objtyp
(account_mgr_id NUMBER(6) ) NOT FINAL;
CREATE TYPE BeerType2 AS OBJECT (
name CHAR(20),
kind CHAR(10),
colour CHAR(10));
CREATE TYPE BeerTableTypeAS
TABLE OF BeerType2;
CREATE TABLE manfs(
age number,
Cust_ref REF Customer_objtyp,
beers BeerTableType,
copy number)
NESTED TABLE beers STORE AS BeerTable;
-- This is new --
CREATE TABLE Customer_objtyp_table OF Customer_objtyp;
-- Now try the following insert --
INSERT INTO manfs
VALUES (10,
(SELECT REF(co) FROM Customer_objtyp_table co WHERE co.CustNo = 1),
BeerTableType(BeerType2('pride','ale','yellow')),
1)I hope this will give you an example of how to use REF and Nested tables.
Yours sincerely
Florian W. -
Insert data file name into table from sql loader
Hi All,
I have a requirement to insert the data file name dynamically into table using sql loader.
Example:
sqlldr userid=username/passwword@host_string control=test_ctl.ctl data=test_data.dat
test_ctl.ctl
LOAD DATA
FILED TERMINATED BY ','
INTO TABLE test
(empid number,
ename varchar2(20),
file_name varchar2(20) ---------- This should be the data file name which can be dynamic (coming from parameter)
test_data.dat
1,test
2,hello
3,world
4,end
Please help..
Thanks in advance.
Regards
Anujyou'll probably have to write your control file on the fly, using a .bat or .sh file
rem ===== file : test.bat ========
rem
rem ============== in pseudo speak =============
rem
rem
echo LOAD DATA > test.ctl
echo FILED TERMINATED BY ',' >> test.ctl
echo INTO TABLE test >> test.ctl
echo (empid number, >> test.ctl
echo ename varchar2(20), >> test.ctl
echo file_name constant %1% >> test.ctl
echo ) >> test.ctl
rem
rem
rem
sqlldr userid=username/passwword@host_string control=test.ctl data=test_data.dat
rem =============== end of file test.bat =======================
http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/ldr_field_list.htm#i1008664 -
How to upload data with dynamic internal table
Hi,
I have to upload the basic , sales, purchasing view data by using bapi depend on check box selected for views.
i have filled fieldcatalog for selected views and pass the field catalog structure to dynamic int table and
import it into the field symbol <fs_data>. this field symbol assigned to <fs_1>.
then callED the 'GUI_UPLOAD ' and when i pass field symbo for function module i am getting first 10 rows 0f the file .
flat file has basic data,sales ,purchase fields data
ex: i was selected basicview and purchase view and execute i am getting basic,sales view data.
how can i get only basic and purchase data.hi ,
please find code.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = lt_fieldcatalog
IMPORTING
ep_table = <fs_data>
EXCEPTIONS
generate_subpool_dir_full = 1
OTHERS = 2.
IF sy-subrc <> 0. "#EC NEEDED
ENDIF.
So <FS_1> now points to our dynamic internal table.
ASSIGN <fs_data>->* TO <fs_1>.
Next step is to create a work area for our dynamic internal table.
CREATE DATA new_line LIKE LINE OF <fs_1>.
A field-symbol to access that work area
ASSIGN new_line->* TO <fs_2>.
ASSIGN new_line->* TO <fs_3>.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = p_f
filetype = 'DAT'
TABLES
data_tab = <fs_1>
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF. -
How to Insert Data in Ztable Using table Control
Hi All,
Please give some ideas of how to store the data from table control into the ztable database.
There is a table control in which the end user enters the data manually and clicks the save button. Then, the data from the table control will go and store in the ztable.
regards
Vicky KumarHi Vicky,
are you talking about ABAP transaction SE11 or about creating tables in the SAP HANA directly, i.e. in the HANA Modeler perspective?
Cheers,
Jasmin -
How to insert data from file into long raw field using utl_file?
I try to insert binary data from a file (under AIX 4.3.3) into a LONG
RAW field (Oracle 8.1.6).
First, I retrieve the data from the file like this:
DECLARE
FileHandle = UTL_FILE.FILE_TYPE;
myVariable LONG RAW;
FileHandle := UTL_FILE.FOPEN ;('prj/oracle/admin/MARTIJN/udump',
'MyFile.ATT', 'R');
UTL_FILE.GET_LINE (FileHandle, myVariable);
UTL_FILE.FCLOSE(FileHandle);
INSERT INTO myTable(DUMMYFIELD) VALUES(myVariable);
Where DUMMYFIELD of table myTable is of type LONG RAW.
The GET_LINE statement crashes on Oracle Error ORA-6502: Numeric of
Value error: hex to raw conversion error.
What do I do wrong?
Do I use the right method to retrieve information from a file and put
it into a long raw field, should I try it another way?
Any help greatly appreciated,
Martijn RutteZarina,
To clarify your problem, you have a script node contaning your Matlab code. Are you then using the standard LV functions to load in your data from a file and pass it into the script node?
Regards
Tristan -
How to insert data from file into matlab script node
I have interfaced input data from file to be processed using matlab script node. But the problem is that I could not capture the multiple data into matlab script node and to convert it into matrix. Further to this I need to process the data by plotting graphs from it. Thank you in advance for the advice
Zarina,
To clarify your problem, you have a script node contaning your Matlab code. Are you then using the standard LV functions to load in your data from a file and pass it into the script node?
Regards
Tristan -
How to insert data into two tables linke with foreign key..
I have two tables
1)EMP(emp_ID,username,emp_type_code)
emp_ID is primary key, emp_type_code is a foreign key references emptype table.
2)emptype(emp_type_code,emp_type_descripton)
emp_type_code is primary key
Could anyone help me ..how to insert data into EMP table. How to insert data into two tables linke with foreign key..CREATE TABLE "CATDB"."DWDIMUSER"
"USER_ID" NUMBER(10,0) NOT NULL ENABLE,
"SPECIALTY_ID" NUMBER(10,0),
"FULLNAME" VARCHAR2(20 BYTE),
"FNAME" VARCHAR2(20 BYTE),
"LNAME" VARCHAR2(20 BYTE),
"USER_SUBTYPE" VARCHAR2(20 BYTE),
CONSTRAINT "DIMUSER_PK" PRIMARY KEY ("USER_ID") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "CATDB" ENABLE,
CONSTRAINT "DIMUSER_DIMSPECIALTY_FK" FOREIGN KEY ("SPECIALTY_ID") REFERENCES "CATDB"."DWDIMSPECIALTY" ("SPECIALTY_ID") DISABLE
CREATE TABLE "CATDB"."DIMSPECIALTY"
"SPECIALTY_ID" NUMBER(10,0) NOT NULL ENABLE,
"SPECIALTY_NAME" VARCHAR2(100 BYTE),
CONSTRAINT "DIMSPECIALTY_PK" PRIMARY KEY ("SPECIALTY_ID") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "CATDB" ENABLE
INSERT INTO DIMUSER (FullName, FNAME, LNAME, USER_TYPE, USER_SUBTYPE)
SELECT DISTINCT
Engineer AS FullName,
regexp_substr(Engineer , '[^,| ]+', 1, 1) as FName,
regexp_substr(Engineer , '[^,| ]+', 1, 2) as LName ,
'Engineer'
FROM EMPLOYEELOOKUP;
INSERT INTO DIMSPECIALTY (SPECIALTY_NAME)
SELECT DISTINCT SPECIALITY
FROM EMPLOYEELOOKUP;
COMMIT;
CREATE TABLE employeelookup ...IS A TABLE THAT HAS ALL THE DATA NEDED TO BE FILLED IN BOTHE TABLES...
CREATE TABLE "CATDB"."EMPLOYEELOOKUP"
"EMPLOYEELOOKUP_ID" NUMBER(10,0) NOT NULL ENABLE,
"ENGINEER" VARCHAR2(25 BYTE),
"SPECIALTY" VARCHAR2(20 BYTE),
CONSTRAINT "DIMSPECIALTY_PK" PRIMARY KEY ("EMPLOYEELOOKUP_ID") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "CATDB" ENABLE
DATA IN EMPLOYEELOOKUP
Engineer, Specialty,
John, Dow, Electronis,
Dow, Jons, Technician
Stan Smithers Sales
Mark, Richards Marketing
Jenny, Lane Marketing
John, Lee Sales
I NEED TO LOAD THE FOREIGN KEY IN DIMUSER FROM THE DIMSPECIALTY TABLE?
BY USING THE LOOKUP TABLE TO MARCH THE NAMES UNDER THE Engineer COLUMN, SPECIALTY COLUMNE DISTICTIVLY BY JOINING THE DIMSPECILTY TO RISTIVE THE PRIMARY KEY AND FILL IT IN THE DIMUSER TABLE AS A FOREIGNE KEY.
Maybe you are looking for
-
Grid Control performance tab not available when on the target home of ASM
I noticed recently that the "Performance" tab/link is not available when you are using 10g Grid Control and you are on the home page of an ASM instance. Can this be explained?
-
Audigy 2ZS Platinum Pro, GamePort
Anyone having issues with this new driver for Vista and gameport not installing? Anyone know a work around to this? Thank you
-
Oracle SOA Suite 11g Certification details needed
All, Wanted to know what are the certifications available in SOA suite 11g? per my understanding, only 'Oracle SOA Foundation Practitioner Exam' is available. Is there a certification specific to Architects? Please let me know, thanks in advance Rega
-
Access Denied with Business Connector 4.7
Dear SAPiens, I am trying to call a RFC-FM via a webservice from outside the SAP system via Business Connector 4.7. I always get a "Access Denied" Error message within the XML answer-envelope. For testing I use the soapUI. I downloaded the WSDL from
-
Hi, I have a system running on WAS 620, since it this does not support client proxy generation, I am thinking to consume the web-service using http. How can I pass SOAP messages using http in WAS 620? In past I have consumed web-service by-passing SO