Friday, May 28, 2021

Oracle Function Returns Two Values

There is a table in a schema that contains three columns, p, low and hi. In the table, p is the primary key. I want to develop a function to return low and hi based on an input variable p. First I create a type.

create or replace type t_low_hi as object ( low number, hi number);  

Then I create a function that finds low and hi based on p, constructs a type object and returns it.

create or replace function f_prob (p_p number)  
return t_low_hi is  
p_Low number;  
p_Hi number;  
Str_sql varchar2(2000);  
Str_sql := 'Select low, hi from t_lookup where p=:1';  
Execute immediate str_sql into p_low, p_hi using p_p;  
return t_low_hi(p_low, p_hi);  

I call the function and retrieve low and hi for p with a value of 0.99.

select x.v.low , x.v.hi from (select f_prob(0.99) v from dual) x; 

Tuesday, January 12, 2021

Updated Online Chinese Document Analytics Tool

We have updated our free online tool for analyzing Chinese documents: A user fills in a textbox with the content and click Submit button. The tool identifies words, displays a word cloud picture and calculates a sentiment index for each sentence. Enjoy!

Identifying words in a sentence is necessary. Chinese words in a sentence are next to each other without spaces separating them, e.g. Chinesewordsinasentencearenexttoeachotherwithoutspacesseparatingthem. And yes, the division of words could be ambiguous. For example, "结婚和尚未结婚的" could mean "married and unmarried" ("结婚 | 和 | 尚未结婚的") or "married, monk, unmarried" ("结婚 | 和尚 | 未结婚的") .