khfaraaz82@gmail.com | c526fe9 | 2012-08-10 22:09:13 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Testcase Name : substr05.aql |
| 3 | * Description : Test substring2(string,position,position) built in function. |
| 4 | * Success : Yes |
| 5 | * Date : 19th April 2012 |
| 6 | */ |
| 7 | |
| 8 | // To test substring2 function with string data stored in an internal dataset. |
| 9 | |
| 10 | drop dataverse test if exists; |
| 11 | create dataverse test; |
| 12 | use dataverse test; |
| 13 | |
| 14 | create type TestType as open { |
| 15 | name : string |
| 16 | } |
| 17 | |
| 18 | create dataset testdst(TestType) partitioned by key name; |
| 19 | |
| 20 | insert into dataset testdst({"name":"UC Berkeley"}); |
| 21 | insert into dataset testdst({"name":"UC Irvine"}); |
| 22 | insert into dataset testdst({"name":"UC LA"}); |
| 23 | insert into dataset testdst({"name":"UC Riverside"}); |
| 24 | insert into dataset testdst({"name":"UC San Diego"}); |
| 25 | insert into dataset testdst({"name":"UC Santa Barbara"}); |
| 26 | insert into dataset testdst({"name":"UT Austin "}); |
| 27 | insert into dataset testdst({"name":"UT Dallas"}); |
| 28 | |
| 29 | write output to nc1:"rttest/string_substr05.adm"; |
| 30 | |
| 31 | for $a in dataset('testdst') |
| 32 | order by $a.name |
| 33 | return substring2($a.name,4,string-length($a.name)); |