Joining multiline sql statement and fitnesse variable are giving ORA-00923

406 views
Skip to first unread message

Marcus Rehm

unread,
Jan 28, 2014, 7:29:45 AM1/28/14
to db...@googlegroups.com
Hi,

I'm facing this behavior when trying to join a fitnesse variable with a multiline sql statement. When page is rendered the resulting query is displayed without any problem, but at execution it rises an ORA-00923 - FROM keyword not found where expected. Does anyone are experiencing the same?

The test is bellow:

!| dbfit.OracleTest |

!| ConnectUsingFile | conexoes/MWDBR.config |

!define consulta {
select 12345 field
from dual
}

| Query | !-select field from ( -! ${consulta} !- )-! |
| field? | 
| 12345 |

Yavor Nikolov

unread,
Jan 28, 2014, 10:26:33 AM1/28/14
to db...@googlegroups.com
I think this is FitNesse-level question. What if you try to define the whole query as variable and then just:
|Query|${sql}|

Yavor


--
You received this message because you are subscribed to the Google Groups "dbfit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dbfit+un...@googlegroups.com.
To post to this group, send email to db...@googlegroups.com.
Visit this group at http://groups.google.com/group/dbfit.
For more options, visit https://groups.google.com/groups/opt_out.

Marcus Rehm

unread,
Jan 29, 2014, 6:05:42 PM1/29/14
to db...@googlegroups.com
Hi Yavor,

I got the problem, actually Fitnesse or DbFit is ignoring the line break when passing the query to the data base. If we put a white space after "select 12345 field" in variable declaration the test ends with no errors. I think it could be DbFit because when page is displayed it respects line breaks.

Yavor Nikolov

unread,
Jan 29, 2014, 6:48:35 PM1/29/14
to db...@googlegroups.com
In Query fixture there is logging of the statement. It can useful for investigation. Can be enabled by:
!|set option|debuglog|true|

It dumps the statement as you observed (second row joined to first without white space).


But in this case I think it's clear: in FitNesse if you deal with new lines, you usually need to surround text by !- -!. This applies to variable definition too. Following seems to work OK:

!define consulta {!-

select 12345 field
from dual
-!}

!define var2 {!-
select field from
(

    select 12345 field
    from dual
)
-!}

| Query | ${var2} |
| field? |
| 12345 |

Yavor


Marcus Rehm

unread,
Jan 29, 2014, 9:52:48 PM1/29/14
to db...@googlegroups.com
Thanks Yavor! I put the query inside variable with the !- -! and it worked.


2014-01-29 Yavor Nikolov <nikolo...@gmail.com>

--
You received this message because you are subscribed to a topic in the Google Groups "dbfit" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/dbfit/A4GbboE-VHI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to dbfit+un...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages