Hi Angelo,
OpenGL.org gives pretty good Pseudo-Code for calculating the Normal vector of a polygon:
Begin Function CalculateSurfaceNormal (Input Polygon) Returns Vector
Set Vertex Normal to (0, 0, 0)
Begin Cycle for Index in [0, Polygon.vertexNumber)
Set Vertex Current to Polygon.verts[Index]
Set Vertex Next to Polygon.verts[(Index plus 1) mod Polygon.vertexNumber]
Set Normal.x to Sum of Normal.x and (multiply (Current.y minus Next.y) by (Current.z plus Next.z))
Set Normal.y to Sum of Normal.y and (multiply (Current.z minus Next.z) by (Current.x plus Next.x))
Set Normal.z to Sum of Normal.z and (multiply (Current.x minus Next.x) by (Current.y plus Next.y))
End Cycle
Returning Normalize(Normal)
End Function
Onxe you have the normal, you can use the Normal's X and Y to determine in which direction it is pointing. It shouldn't be too difficult to create a PLSQL function that accepts an SDO_GEOMETRY, calculates the normal, and then gives you back the direction for the normal.
HTH,
Stefan
PS. I've never really worked with this, only played around with it so you do want to verify the formula for correctnes on a few test records.