Skip to content
Advertisement

How to use different conditions depending on variable value. Pro C / SQL

I am quite new to pro c and wanted to know wether the below is possible.

if this variable has a value it should be used within the sql below : So run for given car value only.

However if car is null then do the following sql: So run for all cars.

Is there a way to merge these two without needing to create duplicate sql queries where ones searches for a given car value and another for all cars.

Any Help would be appreciated.

Advertisement

Answer

As of SQL, that would be


Example from SQL*Plus (don’t worry about &&car substitution variable; you’ll use :car):

Passing variable value:

No value:

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement