vb.net - Conversion of SQL Server to Oracle Select query -


i have select query:

select      sample_number, sample_type, storage_address, external_number       systmx2.tm2_samples 

and need add 2 more columns results of .net syntax code end like"

select      sample_number, sample_type, storage_address, external_number,      somecodearound(storage_address) rowposition,      somecodearound(storage_address) columnposition       systmx2.tm2_samples 

the row , column positions based upon fall in 9 x 9 grid. 9 numbers columns across top , 9 numbers rows down side. lab specimen box hold 81 vials. every vial has number 1 81 , last 3 characters of storage_address value similar fr2-s01-r01-001 or fr2-s01-r01-081. vial number 1 in column 1 , row 1; vial 81 in row 9 column 9. .net code row take last 3 character of storage_address , test decimal.

tryparse(storage_address.substring(storage_address.length - 3), value) 

and take value , convert with:

 cint(decimal.truncate(((value+ 9 - 1) / 9))). 

and column code is:

 (value + 9) - (cint(decimal.truncate(((value + 9 - 1) / 9))) * 9).  

i need make inline select statement can call web service oracle server, not have way create database side. right call result recordset add couple of columns , loop results , add values. know there has better way.

this oracle query returns row , column positions:

select storage_address,      floor((to_number(substr(storage_address, 13, 3))-1)/9)+1 rowposition,     mod(to_number(substr(storage_address, 13, 3))-1, 9)+1 colpostion   t 

here sqlfiddle test values.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -