Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Sudoku: Round 2
CR wrote:
> Just curious, what would that look like (i.e., the plain SQL version)?
>
> Also has anybody tried the sudoku code Mr Morgan posted on his website?
> I copied and pasted it and it doesn't seem to work. I think part of
> the problem is in the get_row_string function, but since I'm hardly an
> expert with PL/SQL I'm not 100% sure:
>
> IF colno = 1 THEN
> sstr := 'SELECT col2 || col3 || col4 || col5 || col6 || col7 ||
> col8 || col9 ' || fclause || TO_CHAR(rowno);
> ELSIF colno = 2 THEN
> sstr := 'SELECT col1 || col3 || col4 || col5 || col6 || col7 ||
> col8 || col9 ' || fclause || TO_CHAR(rowno);
> ELSIF colno = 3 THEN
> sstr := 'SELECT col1 || col2 || col4 || col5 || col6 || col7 ||
> col8 || col9 ' || fclause || TO_CHAR(rowno);
> ELSIF colno = 4 THEN
> sstr := 'SELECT col1 || col2 || col3 || col5 || col6 || col7 ||
> col8 || col9 ' || fclause || TO_CHAR(rowno);
> ELSIF colno = 5 THEN
> sstr := 'SELECT col1 || col3 || col4 || col2 || col6 || col7 ||
> col8 || col9 ' || fclause || TO_CHAR(rowno);
> ELSIF colno = 6 THEN
> sstr := 'SELECT col1 || col3 || col4 || col5 || col2 || col7 ||
> col8 || col9 ' || fclause || TO_CHAR(rowno);
> ELSIF colno = 7 THEN
> sstr := 'SELECT col1 || col3 || col4 || col5 || col6 || col2 ||
> col8 || col9 ' || fclause || TO_CHAR(rowno);
> ELSIF colno = 8 THEN
> sstr := 'SELECT col1 || col3 || col4 || col5 || col6 || col7 ||
> col2 || col9 ' || fclause || TO_CHAR(rowno);
> ELSIF colno = 9 THEN
> sstr := 'SELECT col1 || col3 || col4 || col5 || col6 || col2 ||
> col8 || col2 ' || fclause || TO_CHAR(rowno);
> END IF;
>
> The colno = 9 scenario doesn't make sense...why would you want col2 in
> the string twice?
>
> Anyway, just thought I'd share... Have a wonderful day.
Good catch. I just corrected the code on the psoug.org website.
-- Daniel Morgan Puget Sound Oracle Users GroupReceived on Wed Sep 27 2006 - 15:08:04 CDT
![]() |
![]() |