Question: I need to understand the difference between these two oracle queries specially between `rank() over(order by length(cgp.group_name) desc)` and 
`rank() over(order by length(cgp.group_name), length(csc.subscriber_num) desc) ranking`. 

I searched on google regarding rank and understood below :

> 
> `rank() over(order by length(cgp.group_name),
>  length(csc.subscriber_num) desc) ranking` : one ranking column will
>  display in the result with values 1,2,3 according to the maximum match
>  of group\_name.
> 
> 
> 

```
select csc.subscriber_num csc.group_id, 
       rank() over(order by length(cgp.group_name) desc) ranking  
from scallforward_info csc , 
     gprofile cgp 
where '0120111' like csc.subscriber_num||'%' 
  and   GROUP_NAME like 'TEST' ||'%' 
  and csc.account_number=99995555  
  and   csc.group_id= cgp.group_id  
  and csc.ver = 1 
  and cgp.ver = 1;

select csc.subscriber_num csc.group_id, 
       rank() over(order by length(cgp.group_name), length(csc.subscriber_num)  desc) ranking 
from scallforward_info csc , 
     gprofile cgp 
where '0120111' like csc.subscriber_num||'%' 
  and GROUP_NAME like 'TEST' ||'%' 
  and   csc.account_number=99995555  
  and csc.group_id= cgp.group_id  
  and   csc.ver = 1 
  and cgp.ver = 1;

```

Answer: 
You probably want `TO_TIMESTAMP` instead of `TO_DATE`.

The only bad thing about the Oracle function is the resulting datatype of `TIMESTAMP(6)` which can't be changed:

```
TO_TIMESTAMP('12/03/2015 03:00AM', 'MM/DD/YYYY HH:MIAM')

```

Using Teradata's `FORMAT` you can specify the timestamp precision, but it's less flexible than Oracle's, the string must match the format exactly:

```
CAST('12/03/2015 03:00AM' AS TIMESTAMP(0) FORMAT 'MM/DD/YYYYbHH:MIT')

```

On the Teradata site you'll find the (slow) online docu, e.g. [TO\_DATE formats](http://www.info.teradata.com/HTMLPubs/DB_TTU_15_10/index.html#page/SQL_Reference/B035_1145_151K/format_arg_format_elements_TO_DATE.html) or [Teradata FORMATs](http://www.info.teradata.com/HTMLPubs/DB_TTU_15_10/index.html#page/SQL_Reference/B035_1143_151K/Format_Phrases.040.47.html#ww620520). Of course you should download the [full documentation CD](http://www.info.teradata.com/templates/eSrchResults.cfm?prodline=&txtpid=&txtrelno=&txtttlkywrd=CDROM&rdsort=Date&srtord=Desc&nm=Documentation%20CD%20Images%20-%20Teradata%20Database%20and%20Teradata%20Tools%20and%20Utilities) for your release.
Please tell us at least which programming language are you using.
Normally it would be something like "MM/DD/YYYY HH:MI a" but we need to know first you language.