Does PLSQL have userdefined types UDT Provide an example tha
Does PL/SQL have user-defined types (UDT)? Provide an example that illustrates how UDT helps avoid errors in the code.
Solution
A)
 User defind type of method:-
 CREATE TABLE geo (g geometry)
 go
 CREATE PROCEDURE type_method AS
 SELECT g.nosuchmethod FROM geo
 go
 DROP TABLE geo.
 Example:-Outer Columns in Correlated Subqueries
 CREATE TABLE Orders(ordOrderID int NOT NULL PRIMARY KEY,
 ordCustomerID int NOT NULL,....)
   
 CREATE TABLE OrderDetails (detOrderID int NOT NULL,
 detRowNo smallint NOT NULL,....)
   
 SELECT ...
 FROM Orders
 WHERE ordOrderID IN
 The error here is that the subquery has a column from the outer table in the SELECT list. Perfectly legal, but not that meaningful. More than one have been bitten by this error and posted to SQL forums, thinking that they have hit a bug in SQL Server.They haven\'t, but with strict checks we could help them to detect their mistake earlier. I have two suggestions:
 1.Columns from outer tables must always be prefixed, by alias or table name.
 2.A column in the SELECT list of a correlated subquery must be an expression that includes at least one column from one of the tables in the subquery.
 Both protects against the mishap above in the SELECT list on their own, but you can be coding half asleep and use the wrong alias,in which case the second rule saves you.The first rule, on the other hand,picks up possibly unintended use of columns from the outer tables elsewhere in the subquery.

