<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.3395" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial size=2><SPAN class=599045612-09102008>Hi
All,</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=599045612-09102008></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=599045612-09102008>I am currently using
an in-memory database which offers ODBC connectivity (Oracle Times
Ten).</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=599045612-09102008></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=599045612-09102008>Of course given I am
using ODBC I need to generate and pass SQL commands to the DB. I was
wondering what is the best way to organise SQL statements (canned) and build up
dynamic SQL statements within Erlang?</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=599045612-09102008></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=599045612-09102008>Currently I just
have my static SQL commands in a .hrl file and as a crude example access them
as such:</SPAN></FONT></DIV>
<DIV><SPAN class=599045612-09102008><FONT face=Arial><FONT size=2><SPAN
class=599045612-09102008></SPAN></FONT></FONT></SPAN> </DIV>
<DIV><SPAN class=599045612-09102008><FONT face=Arial><FONT size=2><SPAN
class=599045612-09102008>
</SPAN>odbc:start(),</FONT></FONT></DIV>
<DIV>
<P align=left><FONT face=Arial><FONT size=2><SPAN
class=599045612-09102008> </SPAN>{ok, Ref} =
odbc:connect("DSN=TT_HWHU;UID=<SPAN
class=599045612-09102008>aUID</SPAN>;PWD=<SPAN
class=599045612-09102008>aPWD</SPAN>", [{scrollable_cursors,
off}]),</FONT></FONT></P>
<P align=left><FONT face=Arial><FONT size=2><SPAN
class=599045612-09102008> </SPAN>{selected, ColNames, Data} =
odbc:sql_query(Ref, ?TESTSQL),</FONT></FONT></P></SPAN></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=599045612-09102008>Does anyone know of
a better way of doing this? In particular building up an SQL statement
dynamically - for example in an insert statement?</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=599045612-09102008></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=599045612-09102008>Many
Thanks,</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=599045612-09102008>Dan</SPAN></FONT></DIV><BR><!--eMS5.0.5.D9M.10Y.2008-->
<DIV> </DIV><pre>
***********************************************************************************
The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB.
Authorised and regulated by the Financial Services Authority
This e-mail message is confidential and for use by the
addressee only. If the message is received by anyone other
than the addressee, please return the message to the sender
by replying to it and then delete the message from your
computer. Internet e-mails are not necessarily secure. The
Royal Bank of Scotland plc does not accept responsibility for
changes made to this message after it was sent.
Whilst all reasonable care has been taken to avoid the
transmission of viruses, it is the responsibility of the recipient to
ensure that the onward transmission, opening or use of this
message and any attachments will not adversely affect its
systems or data. No responsibility is accepted by The
Royal Bank of Scotland plc in this regard and the recipient should carry
out such virus and other checks as it considers appropriate.
Visit our websites at:
www.rbs.com
www.rbs.com/gbm
www.rbsgc.com
***********************************************************************************
</pre></BODY></HTML>