Rose::DB::Oracle(3pm)

✨ Rose::DB::Oracle(3pm) ✨

okay bestie gather round πŸ’– this is the Rose::DB::Oracle manual page β€” it's the Oracle driver class for Rose::DB, which is a Perl thing, iykyk. no cap, it's giving "database but make it dramatic." let's get into it πŸ¦‹


🌸 NAME 🌸

Rose::DB::Oracle β€” literally just the Oracle driver class for Rose::DB. that's the whole name. short, sweet, iconic πŸ‘‘


πŸ’… SYNOPSIS πŸ’…

use Rose::DB;

Rose::DB->register_db
(
  domain   => 'development',
  type     => 'main',
  driver   => 'Oracle',
  database => 'dev_db',
  host     => 'localhost',
  username => 'devuser',
  password => 'mysecret',
);

Rose::DB->register_db
(
  domain   => 'production',
  type     => 'main',
  driver   => 'Oracle',
  service  => 'my_pdb',
  host     => 'db.example.com',
  username => 'produser',
  password => 'prodsecret',
);

Rose::DB->default_domain('development');
Rose::DB->default_type('main');
...

$db = Rose::DB->new; # $db is really a Rose::DB::Oracle-derived object
...

πŸŽ€ DESCRIPTION πŸŽ€

so basically, when the driver is "oracle", Rose::DB blesses objects into a class that's derived from Rose::DB::Oracle. ✨ the way that driver names map to class names is configurable β€” go read the docs for Rose::DB's new() and driver_class() methods if you wanna know more. πŸ’…

πŸ’€ important bestie: you cannot use this class directly. like, at all. you gotta use Rose::DB and let its new() method hand you back an object blessed into the right class for you, based on its driver_class() mappings. that's the whole vibe. the class picks you, you don't pick the class 🫢

only the methods that are new or that behave differently from the ones in Rose::DB are documented here. for the full list of methods, go read the Rose::DB docs. no gatekeeping, just a different page ✨

Oracle 9 or later is required. yes, nine. it's giving retro but make it functional 🌈

if you wanna connect to a service instead of a database, use the "service" parameter instead of database when you register the data source β€” exactly like the SYNOPSIS up there shows. this lets you connect to PDBs (Pluggable Databases) πŸ¦‹ iconic, honestly.

πŸ™ˆ Note: this class is a work in progress. support for Oracle databases is not yet complete. if you wanna help out, please contact John Siracusa at siracusa@gmail.com or post to the mailing list. we love a collaborative moment πŸ’–

⭐ CLASS METHODS ⭐

  • default_post_connect_sql [STATEMENTS] β€” get or set the default list of SQL statements that get run immediately after connecting to the database. STATEMENTS should be a list, or a reference to an array, of SQL statements. it returns a reference to the array of SQL statements in scalar context</>, or a list of SQL statements in list context</>. πŸŽ€

the default_post_connect_sql statements run before any statements set using the post_connect_sql method. the default list contains exactly this:

ALTER SESSION SET NLS_DATE_FORMAT = 'YYYY-MM-DD HH24:MI:SS'
ALTER SESSION SET NLS_TIMESTAMP_FORMAT = 'YYYY-MM-DD HH24:MI:SS.FF'
ALTER SESSION SET NLS_TIMESTAMP_TZ_FORMAT = 'YYYY-MM-DD HH24:MI:SS.FF TZHTZM'

and here's the lil plot twist bestie: if one or more "NLS_*_FORMAT" environment variables are set, those format strings above get replaced by the values those environment variables have at the time this module is loaded. so like, timing matters. slay ✨

  • booleans_are_numeric [BOOL] β€” get or set a boolean that says whether or not boolean columns are numeric. πŸ’… here's the tea: Oracle doesn't have a dedicated boolean column type. the two common stand-in column types are CHAR(1) and NUMBER(1). so if "booleans_are_numeric" is true, boolean columns are treated as NUMBER(1) columns containing either 1 or 0. if it's false, they're treated as CHAR(1) columns containing either 't' or 'f'. the default is false. periodt. πŸ“

πŸ¦‹ OBJECT METHODS πŸ¦‹

  • post_connect_sql [STATEMENTS] β€” get or set the SQL statements that will be run immediately after connecting to the database. STATEMENTS should be a list, or a reference to an array, of SQL statements. it returns a reference to an array (in scalar</> context) or a list of the default_post_connect_sql statements and the post_connect_sql statements. here's an example, bestie πŸ‘‡
$db->post_connect_sql('UPDATE mytable SET num = num + 1');

print join("\n", $db->post_connect_sql);

ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'
ALTER SESSION SET NLS_TIMESTAMP_FORMAT='YYYY-MM-DD HH24:MI:SSxFF'
UPDATE mytable SET num = num + 1
  • schema [SCHEMA] β€” get or set the database schema name. 🌸 in Oracle, every user has a corresponding schema. the schema is made up of all the objects that user owns, and it has the same name as that user. so therefore, this attribute defaults to the username if it isn't set explicitly. it's giving "you are your schema" main character energy πŸ‘‘

πŸ”₯ Value Parsing and Formatting πŸ”₯

  • validate_date_keyword STRING β€” returns true if STRING is a valid keyword for the PostgreSQL "date" data type. (yes, it says PostgreSQL, that's literally what the page says, don't come for me bestie 😭) the valid (case-insensitive) date keywords are:
current_date
current_timestamp
localtimestamp
months_between
sysdate
systimestamp
πŸ’€ and then it says: the keywords are case sensitive. both things. yes. it says case-insensitive and then case sensitive. we're just reporting the facts, no notes πŸ™ˆ

any string that looks like a function call (matches "/^\w+\(.*\)$/") is also considered a valid date keyword if keyword_function_calls is true. πŸ’–

  • validate_timestamp_keyword STRING β€” returns true if STRING is a valid keyword for the Oracle "timestamp" data type, false otherwise. the valid timestamp keywords are:
current_date
current_timestamp
localtimestamp
months_between
sysdate
systimestamp

the keywords are case sensitive. and again β€” any string that looks like a function call (matches "/^\w+\(.*\)$/") is also considered a valid timestamp keyword if keyword_function_calls is true. ✨


πŸ‘‘ AUTHORS πŸ‘‘

John C. Siracusa (siracusa@gmail.com), Ron Savage (ron@savage.net.au) β€” legends, both of them πŸ’œ


🌈 LICENSE 🌈

Copyright (c) 2008 by John Siracusa and Ron Savage. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. 🫢 legally iconic, no cap.


and that's a wrap bestie!! πŸŽ€ this gorgeous lil page comes from Rose::DB::Oracle(3pm) in the User Contributed Perl Documentation, generated by perl v5.40.1 and dated 2026-07-31. go forth and connect to your PDBs πŸ’…βœ¨πŸ’–

πŸ“¦ where this page comes from