insert timestamp

69 views
Skip to first unread message

Midana

unread,
May 2, 2013, 7:05:42 PM5/2/13
to oracle...@googlegroups.com
how can I insert sysdate. 

insert into trajetoria values ('Ir pra Faculdade', 
                               ListaPosicaoTempoEspaco_ty( to_timestamp(sysdate,'DD-MON-RRRR HH:MI PM'),
                                      SELECT REF(pg) FROM pontogeografico pg WHERE pg.latitude = '-3.728876' and longitude = '-38.521006'),
                               SELECT REF(u) FROM usuario u WHERE u.NOME = 'Midana');

Michael Moore

unread,
May 2, 2013, 8:13:12 PM5/2/13
to oracle-plsql
SQL> describe mytab99
TABLE mytab99
 Name                                      Null?    Type                        
 ----------------------------------------- -------- ----------------------------
 MYDATE                                             DATE                        
SQL> insert into mytab99 (mydate) values (sysdate)
1 row created.
SQL> commit
Commit complete.
SQL> select * from mytab99

MYDATE   
---------
02-MAY-13
1 row selected.


--
--
You received this message because you are subscribed to the Google
Groups "Oracle PL/SQL" group.
To post to this group, send email to Oracle...@googlegroups.com
To unsubscribe from this group, send email to
Oracle-PLSQL...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/Oracle-PLSQL?hl=en
 
---
You received this message because you are subscribed to the Google Groups "Oracle PL/SQL" group.
To unsubscribe from this group and stop receiving emails from it, send an email to oracle-plsql...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Midana Sana

unread,
May 2, 2013, 8:18:40 PM5/2/13
to oracle...@googlegroups.com
thanks Michael, but my column type is timestamp.

Midana Fernandes Sana
" O filho sábio atende à instrução do pai; mas o escarnecedor não ouve a repreensão."


2013/5/2 Michael Moore <michae...@gmail.com>
You received this message because you are subscribed to a topic in the Google Groups "Oracle PL/SQL" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/oracle-plsql/3IXDcW7JlrE/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to oracle-plsql...@googlegroups.com.

ddf

unread,
May 3, 2013, 9:58:23 AM5/3/13
to oracle...@googlegroups.com
There is no need for this:

 ( to_timestamp(sysdate,'DD-MON-RRRR HH:MI PM')

since there exists the systimstamp pseudo-column.  

SQL> create table ts_test(
  2          mydata  varchar2(12),
  3          my_timestmp     timestamp
  4  );

Table created.

SQL>
SQL> begin
  2          for i in 1..1000 loop
  3                  insert into ts_test
  4                  values('SNORM'||i, systimestamp);
  5          end loop;
  6
  7          commit;
  8
  9  end;
 10  /

PL/SQL procedure successfully completed.

SQL>
SQL> select * from ts_test;

MYDATA       MY_TIMESTMP
------------ ---------------------------------------------------------------------------
SNORM1       03-MAY-13 07.55.21.674000 AM
SNORM2       03-MAY-13 07.55.21.674000 AM
SNORM3       03-MAY-13 07.55.21.674000 AM
SNORM4       03-MAY-13 07.55.21.674000 AM
SNORM5       03-MAY-13 07.55.21.674000 AM
SNORM6       03-MAY-13 07.55.21.674000 AM
SNORM7       03-MAY-13 07.55.21.674000 AM
SNORM8       03-MAY-13 07.55.21.674000 AM
SNORM9       03-MAY-13 07.55.21.674000 AM
SNORM10      03-MAY-13 07.55.21.674000 AM
SNORM11      03-MAY-13 07.55.21.674000 AM

MYDATA       MY_TIMESTMP
------------ ---------------------------------------------------------------------------
SNORM12      03-MAY-13 07.55.21.674000 AM
SNORM13      03-MAY-13 07.55.21.674000 AM
SNORM14      03-MAY-13 07.55.21.674000 AM
SNORM15      03-MAY-13 07.55.21.674000 AM
SNORM16      03-MAY-13 07.55.21.674000 AM
SNORM17      03-MAY-13 07.55.21.674000 AM
SNORM18      03-MAY-13 07.55.21.674000 AM
SNORM19      03-MAY-13 07.55.21.674000 AM
SNORM20      03-MAY-13 07.55.21.674000 AM
SNORM21      03-MAY-13 07.55.21.674000 AM
SNORM22      03-MAY-13 07.55.21.674000 AM
...

Please note how the insert was accomplished in the PL/SQL block which populated the table.


David Fitzjarrell

Midana

unread,
May 7, 2013, 4:51:43 PM5/7/13
to oracle...@googlegroups.com
thanks friends
Reply all
Reply to author
Forward
0 new messages