Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help calling an Oracle function
Message
De
29/02/2000 07:23:12
 
 
À
28/02/2000 09:45:08
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00338265
Message ID:
00339002
Vues:
24
Hi!

The SQLEXEC() Command simply executes a sql command on the server.
There are often many ways of achieving the same result in SQL.


I guess my difficulty in understanding this comes from my unfamiliarity with the
SQLExec() command. It seems to me that I really must pass through this
string "lcSQL" literal values for the variables as opposed to the variables
themselves.

>This is just a matter of opinion both methods should work fine.
>

My reasoning (again, I am a novice and may be over analyzing) is
that once we pass the "lcSQL" it goes on over to some Oracle driver that will
be unaware as to the values of "charvar1" and "charvar2". The solution would
be simple if I was only dealing with characters and numbers and not dates. If it
were just characters, then I could do this:

>It is not that the server is unaware of the values in your variables
as it is.

Run the following commands

with SQLEXEC
a simple test.

h=SQLCON()
SQLEXEC(h,"CREATE TABLE TEST (col1 number, col2 date)")
var1=1
var2=datetime()

SQLEXEC(h,"insert into test values(?var1,?var2)")
var1=2
var2=datetime()
SQLEXEC(h,"insert into test values(?var1,?var2)")

SQLEXEC(h,"select * from test","test")
brow

SQLEXEC(h,"drop table test")

The only advantage to this approach is that the Oracle server does not need to Reparse the SQL statement because
there is an identical statement in it's cache.
As you can see it is aware of the changes to the variables...

>

However, what does Oracle expect as the date delimiter in lcSQL? I know it is
not the brackets below. Or, is all this unnecessary?

charvar1="09120920"
charvar2="20992"
datevar=datetime()

Either use: Easier!

lcSQL="{Call pwadm.PSINSRT(?charvar1,?charvar2,?datevar) }"

OR

charvar1="09120920"
charvar2="20992"
?????
datevar="to_date("+ttoc(datetime())+"?????"
???I can't remember how to do this!

You will need to look up the to_date() function in your oracle documentation!


I hope that helps you understand what I am getting at here.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform