Typically any code I write in Oracle it is most often in a procedure or function in a package. At times a stand alone procedure.
The coding performed in an Oracle Procedure can be done in a script file but since I do not do that often I created this post for a copy-paste sample that can be run as a script.
--Declare the VARS outside the begin
begin -- Start of Coding
for i in (select constraint_name
where constraint_type = 'R'
and owner = 'MDSYS'
and status = 'ENABLED')
dbms_output.put_line('constraint_name' || i.constraint_name);
end; -- End Coding
Here is the DBMS Output from the query code above.