oceanbase / oceanbase/obclient

[Feature]: Permanently change the NLS_DATE_FORMAT setting

Open
#28 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
94
Forks
42
PR merge metrics
No merged PRs in 30d

Description

Describe your use case

It is recommended that obclient first try to read OB related settings from the operating system environment variable NLS_DATE_FORMAT.
See Oracle sqlplus behavior.

When the operating system does not set the time display format, select sysdate from dual; output:
11-March-24

After operating system configuration variables
export NLS_DATE_FORMAT="yyyy-mm-dd hh24:mi:ss"
export NLS_TIMESTAMP_FORMAT="yyyy-mm-dd hh24:mi:ss"

select sysdate from dual; PLSQL, sqlplus output SYSDATE:
2024-03-11 13:05:31

Avoid script execution after obclient login database connection:
ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS';
ALTER SESSION SET NLS_TIMESTAMP_FORMAT='YYYY-MM-DD HH24:MI:SS.FF6';

Describe the solution you'd like

I'm not sure how PLSQL DEVELOPER and SQLplus read related variables when obclient starts.

Describe alternatives you've considered

No response

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing obclient startup and session initialization to see how operating-system environment variables and session settings are currently handled. Compare the desired behavior with Oracle sqlplus, then verify that NLS_DATE_FORMAT and NLS_TIMESTAMP_FORMAT are applied automatically and produce the requested date and timestamp output without manual ALTER SESSION commands.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, shell, sql
Domain
cli, database
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.