Hi.
Can you tell me how to initialize a user variable from within a pl/sql code block?
I wish to initialize it and outside the block use an if statement to determine if the code outside the block should execute.
The following code is what we did so far.
Thanks.
Emad
Can you tell me how to initialize a user variable from within a pl/sql code block?
I wish to initialize it and outside the block use an if statement to determine if the code outside the block should execute.
The following code is what we did so far.
Thanks.
Emad
Code:
Clear columns
Clear breaks
Clear computes
Set echo off
Set feedback off
Set verify off
Prompt
Prompt "Import DMR Trips, Clients, Segments, Groups, and Programs into the AVL server."
Prompt
Accept aUser prompt 'Enter User Name: '
connect &aUser@dmrads
Accept aTravelDate prompt 'Enter TravelDate as [DD-MON-YYYY] (Example: 01-SEP-2005): '
SET serverOutput ON
Declare
aTotalTrips Number (10);
Begin
Select count(*)
Into aTotalTrips
From dev.myTable
Where travel_date = '&&aTravelDate';
If aTotalTrips > 0
Then
dbms_output.put_line ('');
dbms_output.put_line ('');
dbms_output.put_line ('');
dbms_output.put_line ('');
dbms_output.put_line ('Please remove the schedules first for this date.');
dbms_output.put_line ('');
dbms_output.put_line ('');
dbms_output.put_line ('');
Else
dbms_output.put_line ('');
dbms_output.put_line ('');
dbms_output.put_line ('Processing...');
dbms_output.put_line ('');
dbms_output.put_line ('');
-- I wish to initialize the user variable here.
End If;
End;
/
-- The if statement would go here
-- If the user variable = theValue
Then
-- Code I want to execute goes here.
End If;
Prompt "Processing has finished. Press any key to continue."
pause
Exit