Sort Field Values in a Row

Question

I have a table which consists of six columns:

Table name: orders

num1 number, num2 number , num3 number , num4 number , num5 number , num6 number

There is a routine which fills the data in this table, but the order of the inserted data is casual.
My requirement is to create a view over this table in an organized manner. Say this is a row in the table:

num1 , num2 , num3 , num4, num5 , num6
------------------------------------------------------------------------
2 7 38 8 19 49

I need to order content of this row in the way I have in the view the data ordered in ascending order, so the data should appear in the view in the following way:

num1 , num2 , num3 , num4 , num5 , num6
--------------------------------------------------------------------
2 7 8 19 38 49

Could anyone please suggest a way to accomplish this?

 

Answer

The requirement is to rearrange values in each row and populate them back. It’s easy to do it in SPL (Structured Process Language):

A

1

=connect("test")

2

=A1.query("select *   from arrangeRow")

3

=A2.(~.record(~.array().sort()))  

A1: Connect to database.

A2: Query over the source table.

A: Convert each row in A2 into an array and sort it and populate the values back to A2’s table.

A2

undefined

A2

undefined