Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to do this in VFP
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 7 SP1
OS:
Windows 2000 SP4
Network:
Novell 6.x
Database:
Oracle
Divers
Thread ID:
01033548
Message ID:
01033583
Vues:
15
I'm sorry,

-1 is flag of error in SQL command.
You can create Stored procedure or function on Oracle and call it.
-- Oracle
-- Stored procedure
CREATE OR REPLACE PACKAGE Foxpackage AS
TYPE IDSequenceNumber IS TABLE OF INTEGER
  INDEX BY BINARY_INTEGER;

 PROCEDURE GetSequence
 (
  SequenceNumber  OUT  IDSequenceNumber
 );

  END Foxpackage;
/

CREATE OR REPLACE PACKAGE BODY Foxpackage AS
  
PROCEDURE GetSequence
 (
  SequenceNumber  OUT  IDSequenceNumber
 )
 IS
 BEGIN
  SequenceNumber(1):=seqsystemkey.nextval;
 END GetSequence;
* VFP code
lihdbcMS=SQLSTRINGCONNECT("driver={microsoft odbc for oracle};"+;
         "connectstring=orcl1; uid=test; pwd=test;")
lcExec="{call FoxPackage.GetSequence({resultset 1, SequenceNumber })}"
?SQLEXEC(lihdbcMS,lcExec,"NewAlias")
?NewAlias.SequenceNumber
=SQLDISCONNECT(lihdbcMS)
MartinJ

PS: I don't test it
>>Hello Aafzal,
>>
>>
>>m.handle=SQLSTRINGCONNECT("...")
>>=sqlexec(m.handle,"SELECT seqsystemkey.nextval")
>>
>>
>>MartinJ
>>
>>>hello all
>>>
>>>how to call oracle sequence from Visual Foxpro ?
>>>
>>>in other words how to code this in vfp
>>>select seqsystemkey.nextval from dual;
>>>
>>>TIA
>
>MartinJ
>
>Thanks for your reply, but i get -1 as nextval
>
>here's the script from Oracle for SEQUENCE seqsystemkey
>
>CREATE SEQUENCE DOCSADM.SEQSYSTEMKEY
> START WITH 2249460
> MAXVALUE 999999999999999999999999999
> MINVALUE 1
> NOCYCLE
> CACHE 20
> ORDER;
>
>GRANT ALTER, SELECT ON DOCSADM.SEQSYSTEMKEY TO DOCS_USERS;
>
>my vfp code return -1
>
>STORE SQLSTRINGCONNECT('dsn=dsnTEST;uid=docsadm;pwd=test') TO gnConnHandle
>
>IF gnConnHandle < 0
> = MESSAGEBOX('Cannot make connection', 16, 'Oracle Connect Error')
>ELSE
> = MESSAGEBOX('Connection made', 48, 'Oracle Connect Message')
> nextkey=SQLEXEC(gnConnHandle,"SELECT seqsystemkey.nextval")
> ?nextkey
> = SQLDISCONNECT(gnConnHandle)
>ENDIF
>
>thanks
"Navision is evil that needs to be erazed... to the ground"

Jabber: gorila@dione.zcu.cz
Jabber? Jabbim
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform