Skip to content

Instantly share code, notes, and snippets.

View plamen9's full-sized avatar

Plamen Mushkov plamen9

View GitHub Profile
@plamen9
plamen9 / chatgpt_requests.sql
Last active May 27, 2023 20:57
A procedure to allow reusing ChatGPT prompts and responses from a local table
declare
l_prompt clob;
l_response clob;
l_response_text clob;
l_prompt_tokens number;
l_completion_tokens number;
l_total_tokens number;
chatgpt_error EXCEPTION;
PRAGMA exception_init(chatgpt_error, -20001);
@plamen9
plamen9 / convert_geometry_types.sql
Last active October 21, 2022 10:08
Converting GeoJSON, SDO_GEOMETRY, Latitude and Longitude
-- *** Types conversion examples ***
 
-- Convert SDO_GEOMETRY to GeoJSON
select apex_json.stringify( 
 mdsys.sdo_geometry( 2001, 4326, sdo_point_type( 10, 50, null ), null, null ) 
 )
from dual;
select apex_json.stringify( 
 MDSYS.SDO_GEOMETRY(2002, NULL, NULL, 
@plamen9
plamen9 / geojson_sdo_geometry.sql
Last active October 21, 2022 10:10
GeoJSON, SDO_GEOMETRY examples
-- *** Single Point *** 
 
-- GeoJSON
{"type": "Point", "coordinates": [-0.051, 51.50254]}
-- SDO_GEOMETRY
MDSYS.SDO_GEOMETRY(2001, 4326, MDSYS.SDO_POINT_TYPE(-0.051, 51.50254, NULL), NULL, NULL);
-- Longitude/Latitude
Longitude: -0.051
var lMapRegion = apex.region("map_search"),
// important: Use the layer name exactly as specified in the "name" attribute in Page Designer
lLayerId = lMapRegion.call("getLayerIdByName", "Map Search"),
lCurrentZoom = lMapRegion.call("getMapCenterAndZoomLevel").zoom,
lLocationId = apex.item("P27_GEOLOCATOR").getValue(),
lFeature = lMapRegion.call("getFeature", lLayerId, lLocationId ),
lPosition;
console.log("lLocationId -> " + lLocationId);