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