Skip to main content

Hi,

 

 

I have an attribute (timeattribute) that I would like to save to an oracle table
  timeattribute = '2017-06-30 18:39:05'

Within a sqlexecuor, I'm doing something like: 

INSERT INTO TEST_T
  (
    OBJECTID,    
    TIMEATTRIBUTE
  )
  VALUES
  (
    @Value(OBJECTID),
   '@Value(TIMEATTRIBUTE)'
   )    

and it failed. How can I make it work?

 

FYI, the query
INSERT INTO TEST_T
  (
    OBJECTID,    
    TIMEATTRIBUTE
  )
  VALUES
  (
    @Value(OBJECTID),
   sysdate
   )   

worked perfectly within the sqlexecutor.

Thanks

You need to use the to_date function to insert into oracle, e.g.


This is more of an Oracle question, you'll have to use the to_date() function. Example:

INSERT INTO TEST_T
  (
    OBJECTID,    
    TIMEATTRIBUTE
  )
  VALUES
  (
    @Value(OBJECTID),
   to_date('@Value(TIMEATTRIBUTE)', 'YYYY-MM-DD HH24:MI:SS')
   ) 

Just another thing, you should be careful about manually inserting OBJECTID values unless you've queried the relevant SDE function for the next value. The issue is that the OBJECTID column is tied to an Oracle sequence and if you insert your own values without simultaneously updating the sequence you risk primary key collisions down the line.

From the ESRI FAQ: http://support.esri.com/en/technical-article/000008996

More technical info here: http://desktop.arcgis.com/en/arcmap/10.3/manage-data/using-sql-with-gdbs/next-rowid.htm


This is more of an Oracle question, you'll have to use the to_date() function. Example:

INSERT INTO TEST_T
  (
    OBJECTID,    
    TIMEATTRIBUTE
  )
  VALUES
  (
    @Value(OBJECTID),
   to_date('@Value(TIMEATTRIBUTE)', 'YYYY-MM-DD HH24:MI:SS')
   ) 
@david_r,

 

Thanks

 

 


Reply