BookmarkSubscribeRSS Feed
shuchidxt_gmail_com
Obsidian | Level 7

Hi,

 

I am trying to load Teradata table from SAS wrkmrg.ava_prty_lt3 TABLE and getting below error but there is no value in the table which is missing. what is wrong here?

 

proc sql;
  create table wrkmrg.ava_prty_lt3 as
     select distinct
      input(compress(trim("&req_id.")),8.) length = 10 as request_id,

         'CAAPTest' length = 30 as USER_ID,           /*user  */
         PARTY_ID1 format = 11.0 as WCIS_CLIENT_ID , /* client id*/
         'CAAPGroup' length = 50 as REQUEST_DEPT, /*department name */
         intnx('day',today(),0) format = yymmddd10. as REQUEST_DATE,   /* request date is current date*/       
        'NEW' length = 100 as STATUS
        FROM wrkmrg.ava_prty_lt2
     order by party_id1;
 
 
 proc sql noprint ;
        INSERT INTO MCLP.WCIS_CLNT_DISP_IN (multistmt = yes)
        SELECT distinct
           request_id,
          user_id,
           wcis_client_id,
           request_dept,
          request_date,
          status
           FROM wrkmrg.ava_prty_lt3;
 
ERROR: Teradata insert: Syntax error: Data Type "," does not match a Defined Type name.

7 REPLIES 7
s_lassen
Meteorite | Level 14

I am not sure, but the problem may stem from the REQUEST_ID variable. LENGTH=10 is not applicable to numeric variables. Is the variable numeric on Teradata? If not, you should convert it to character. What exactly are you trying to do with that variable?

 

Other than that, if you have a problem with missing values, it may be that the Teradata table has more columns than the table you are trying to insert from. In which case you should specify the variables on the target table on the insert statement (good programming practice anyway), e.g.

insert into <teradata table>(multistmt=yes)(<target variables>)
  select <source variables>
  from <sas table>
shuchidxt_gmail_com
Obsidian | Level 7

yes the variable is decimal 10.0 field in the Teradata. I have checked Teradata table and it has same fields/columns.

 

below is the ddl for the same.

 

CREATE MULTISET TABLE P_WDM_S_WCIS_UMD.WCIS_CLNT_DISP_IN ,NO FALLBACK ,

     NO BEFORE JOURNAL,

     NO AFTER JOURNAL,

     CHECKSUM = DEFAULT,

     DEFAULT MERGEBLOCKRATIO,

     MAP = TD_MAP2

     (

      REQUEST_ID DECIMAL(10,0),

      USER_ID VARCHAR(30) CHARACTER SET LATIN NOT CASESPECIFIC,

      WCIS_CLIENT_ID DECIMAL(10,0),

      REQUEST_DEPT VARCHAR(50) CHARACTER SET LATIN NOT CASESPECIFIC,

      REQUEST_DATE DATE FORMAT 'YYYY-MM-DD',

      STATUS VARCHAR(100) CHARACTER SET LATIN NOT CASESPECIFIC)

PRIMARY INDEX PI_WCIS_CLNT_DISP_IN ( REQUEST_ID ,USER_ID ,WCIS_CLIENT_ID ,

REQUEST_DEPT );

ChrisNZ
Tourmaline | Level 20

> the variable is decimal 10.0 field in the Teradata

In this case why not just use

 &req_id. as request_id,

 

Also this should be enough as well, no?
today()  format = yymmddd10. as REQUEST_DATE,  

shuchidxt_gmail_com
Obsidian | Level 7

I have tried that well but it did not work

Tom
Super User Tom
Super User

Show the actual log. Make sure to use the INSERT CODE button and paste the lines into the pop-up window so that formatting is preserved.

 

Remember that SAS only has two data types.  Fixed length character strings and floating point numbers.

 

If you have defined the variable as 10 decimal places in Teradata then make sure that non of the values of your data are non integers

request_id=round(request_id,1);

and that the absolute value is always less then 10,000,000,000.  Otherwise Teradata will not be able to store the value.

if abs(request_id) >= 10E10 then put 'ERROR: Magnitude too large ' request_id= ;
shuchidxt_gmail_com
Obsidian | Level 7
Here is the snippet of the log error:
 
287        proc sql noprint ;
288         INSERT INTO MCLP.WCIS_CLNT_DISP_IN(multistmt = yes)
289          SELECT distinct *  FROM wrkmrg.ava_prty_lt3;
NOTE: 7860 rows were inserted into MCLP.WCIS_CLNT_DISP_IN.
ERROR: Teradata insert: Syntax error: Data Type "," does not match a Defined Type name. SQL statement was: USING (A0A
       DECIMAL(10),A0B VARCHAR (30),A0C DECIMAL(10),A0D VARCHAR (50),A0E DATE,A0F VARCHAR (100),A0G D
 
 
Though there is no data having , and the input data looks like as below:
 
995 CAAPTest 51 CAAPGroup 02/28/2020 NEW
995 CAAPTest 83 CAAPGroup 02/28/2020 NEW
995 CAAPTest 238 CAAPGroup 02/28/2020 NEW
995 CAAPTest 2346 CAAPGroup 02/28/2020 NEW
995 CAAPTest 3428 CAAPGroup 02/28/2020 NEW
995 CAAPTest 5901 CAAPGroup 02/28/2020 NEW
995 CAAPTest 7361 CAAPGroup 02/28/2020 NEW
995 CAAPTest 10346 CAAPGroup 02/28/2020 NEW
995 CAAPTest 18842 CAAPGroup 02/28/2020 NEW
995 CAAPTest 23466 CAAPGroup 02/28/2020 NEW
995 CAAPTest 24245 CAAPGroup 02/28/2020 NEW
995 CAAPTest 25760 CAAPGroup 02/28/2020 NEW
995 CAAPTest 35979 CAAPGroup 02/28/2020 NEW
ChrisNZ
Tourmaline | Level 20

It looks like you may have non printable characters somewhere.

You could clean your code by pasting it into something like notepad and back.

You could use a function like NOTPRINT or NOTGRAPH to scan the data.

I know it may sound silly, but the silly takes place often.

 

Another option is reducing the size of the upload until a rogue row is identified.

 

Lastly proc append may be faster for this task.

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 1720 views
  • 0 likes
  • 4 in conversation