473,396 Members | 1,743 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

how to insert a null value in a db2 datetime column ?

2
Hi,

I have a PL1 program to load a DB2 table with datetime zone (null allowed)

Usually when i have to load null values, I used nullindicator with -1 value but here, with a datetime variable i received sqlcode = -180.

How can I do ?

Thx

here is the code :
Expand|Select|Wrap|Line Numbers
  1.  PTXB003: PROC OPTIONS(MAIN);                                           
  2.  
  3. -EXEC SQL INCLUDE SQLCA;                                                
  4.  EXEC SQL DECLARE GTXCINDI.RELEVE_PRIJSOPNAME TABLE                     
  5.            ( . . .                                                      
  6.              D_MODIFIED_NOW_TS              TIMESTAMP,                  
  7.              . . .                                                      
  8.             ) ;                                                         
  9.  /*********************************************************************/
  10.  /* PLI DECLARATION FOR INPUT SEQ FILE                                */
  11.  /*********************************************************************/
  12. 1/* ----------------------------------------------------------------- */
  13.  /* INPUT                                                             */
  14.  /* ----------------------------------------------------------------- */
  15. -DCL INFIL FILE RECORD;                                                 
  16. 0DCL  1 RELEVEP,                                                        
  17.       5 ...                                                             
  18.       5 D_MODIFIED_NOW_TS                   CHAR(26),                   
  19.       5 ...;                                                            
  20. 0ON ENDFILE(INFIL) BEGIN;                                               
  21.     GOTO FIN;                                                           
  22.     END;                                                                
  23. 1/* ----------------------------------------------------------------- */
  24.  /* VARIABLES                                                         */
  25.  /* ----------------------------------------------------------------- */
  26. 0DCL (STRING,SUBSTR,TRANSLATE,MOD,INDEX,TIME,DATE) BUILTIN;             
  27.  DCL PLIRETC BUILTIN;                                                   
  28. DCL CTR PIC'999999' INIT(0);                                        
  29. DCL IND1  BIN FIXED(15) INIT(-1);                                   
  30.    /* ------------------------------------------------ */           
  31.    /*                  DEBUT TRAITEMENT                */           
  32.    /* ------------------------------------------------ */           
  33.          OPEN FILE(INFIL) INPUT;                                    
  34.     /* --------------------------------------------------------- */ 
  35.     /* TRAITEMENT                                                */ 
  36.     /* --------------------------------------------------------- */ 
  37. LECTURE: READ FILE(INFIL) INTO(RELEVEP);                            
  38.          IF RELEVEP.D_MODIFIED_NOW_TS ^= '' THEN IND1 = 0;          
  39.                                     ELSE IND1 = -1;                 
  40.          EXEC SQL INSERT INTO GTXCINDI.RELEVE_PRIJSOPNAME           
  41.           ( ...,                                                    
  42.             D_MODIFIED_NOW_TS,                                      
  43.             ...)                                                    
  44.          VALUES                                                     
  45.           ( :...,                                                   
  46.             :RELEVEP.D_MODIFIED_NOW_TS :IND1,                       
  47.             :...);                                                  
  48.          IF SQLCODE ^= 0 THEN DO;                                   
  49.            PUT SKIP EDIT('ERREUR CREATION RELEVE_PRIJSOPNAME')(A);  
  50.            GOTO ERRSQL;                                             
  51.            END;                                                     
  52.          CTR = CTR + 1;                                             
  53.          GOTO LECTURE;                                              
  54.     /* --------------------------------------------------------- */ 
  55.     /* ERREUR SQL                                                */ 
  56. ERRSQL: PUT SKIP LIST ('ERROR RAISED ON FETCH :' , SQLCODE);      
  57.         CALL PLIRETC(99);                                         
  58. FIN:   PUT SKIP DATA(CTR);                                        
  59.        CLOSE FILE(INFIL);                                         
  60. END PTXB003;
  61.  
Nov 19 '07 #1
1 5437
huks
2
sorry guys the problem is not a problem but a mistake in my input file.

Sorry for that
Nov 19 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: stefy | last post by:
I'd like insert null value from a query but i can do it, if my query is : UPDATE table:name UPDATE euro='' WHERE id='5'; i have a sybase message warning like this : Error converting data type...
6
by: FatboyCanteen | last post by:
When I using dataset to append a null value to the datetime field. It throw a error -> can not convert db.null to system.date Can there is any standard to pass a Null value to the DateTime...
26
by: Martin R | last post by:
Hi, How to find first not null value in column whitout chacking whole table (if there is a not null value then show me it and stop searching, the table is quite big)? thx, Martin *** Sent...
0
by: hemant123 | last post by:
Hi I Am Trying To Insert Null Value In Oracle Date Column Using Visual Basic 6 Textbox. I Tried Various Options But Unable To Insert. Please Advise Me A Solution. Thanks In Advance Hemant
1
by: hemant123 | last post by:
Hi I am trying to insert null value in date field using vbasic textbox.I tried various options but failed.Please tell me the solution. Thanks in advance. Hemant
1
by: billa856 | last post by:
Hi, I am trying to insert Null value in column(ShipDate) in my table.That column(ShipDate)'s type id date/time and format is short date. I am using "" to insert Null in that column(ShipDate)...
2
by: RN1 | last post by:
How do I insert NULL values in a SQL Server DB table in a column whose datatype is int? This is what I am trying currently (in the UpdateCommand event function of a DataGrid): ...
2
by: dmorand | last post by:
I have this query that I'm using in coldfusion: Insert into ps_manager_employee_ids (manager_emplid,emp_id,last_name,first_name,hire_dt,rehire_dt,emp_status,union_status) values...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.