Reputation: 524
I would like to use a switch case for connect to different sets of databases, is it possible to use the connect statement with a .pf file that only contains -db parameters? I have tried it but I always get error 1402: parameter -p is not a database parameter and was ignored. But there is no -p parameter in my .pf files...
Something like this:
CASE Db_Name:
WHEN "Test":
CONNECT TO 'test.pf'.
END.
OTHERWISE:
CONNECT TO 'Db.pf'.
END.
END CASE.
Thanks in advance
Upvotes: 1
Views: 429
Reputation: 14020
"TO" is not part of the syntax for CONNECT. Your CASE syntax is also wrong.
Try this:
case dbName:
when "sports" then
connect value( "-pf sports.pf" ).
when "sports2000" then
connect value( "-pf sports2000.pf" ).
end.
or, more simply:
connect value( substitute( "-pf &1.pf", dbName )).
Upvotes: 4