Pro*C Syntax



  • In the C program , all the SQL statements must start with EXEC SQL, and will end with the semicolon ;.
  • We can write the SQL statement anywhere within the program but with one restriction that declarative statements shouldn't come after the executable statements.
 Syntax

Syntax

  • Suppose we would like to retrieve the marks from the database supported their id, then its program would be written as:
{   
int marks;  
EXEC SQL select marks INTO : marks from student where student_id=6;  
printf("The marks of the student is : %d", marks);  
} 

Preprocessor directives

  • The preprocessor directives that we will use once we are handling Pro*C in C are #include and #if. But, Pro*C doesn't realize the #define directive. Let's understand this through an easy scenario which is given below:
#define employee_id
int salary;  
EXEC SQL select salary into : salary from employee where employee_id=5;  
  • The above code is invalid, as Pro*C doesn't work with a #define directive.


Related Searches to Pro*C Syntax