Question: I have a date column in source which is defined as varchar(255). I want to convert that to timestamp(0). I am using the below query:

```
SEL CAST(CAST( SERIND AS CHAR(10)) || ' 00:00:00' AS TIMESTAMP(0))
FROM DP_BOX.SOC1
WHERE SERIND ='20130518'

```

I am getting invalid timestamp here. Sample SERIND are 

```
20170509
00000000

```

Can anyone please help me on this?

Answer: 
Because an array `int [a][b]` (2D int array) is not a compatible type with `int*` (int pointer). A 2D array when used in an expression decays to a pointer to the first element, which in this case would be an array pointer to a 1D array, of type `int(*)[b]`.

The line `ptr[b]=arr;` therefore makes no sense and it also access the array `ptr` out of bounds.

If you wish to have a pointer to the first item in the 2D array, you would have to type 

```
ptr[n] = &arr[0][0]; // where n is a value that makes sense

```
I have changed the code as the following listing:

```
    #include<stdio.h>
    #include<string.h>
    #include<stdlib.h>
    #include<time.h>
    int main()
    {
        int a,b,i,j;

        scanf("%d%d", &a, &b);
        int *arr[a][b];
        int *ptr[b];
        int *k = 0;
        ptr[b]=arr[a][b];
        printf("\n%s%p","pointer = ",ptr[b]);
        for(i=0;i<a;i++)
        {
          for(j=0;j<b;j++)
        {
            *(*(arr+i)+j)=k;
              k++;
        }
        }
        for(i=0;i<a;i++)
       {
       for(j=0;j<b;j++)
       {
                printf("%p\t",*(*(arr+i)+j));
        }
        printf("\n");
        }
        return 0;
        }

```