Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8769487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:21:36+00:00 2026-06-13T17:21:36+00:00

I am curious why PL/SQL does not let me declare a var as datetime

  • 0

I am curious why PL/SQL does not let me declare a var as datetime and what my alternatives are. I am using Oracle 11.

VARIABLE some_date date;

And I get the following error message indicating legal types for a var, date not being included:

 Usage: VAR[IABLE] [ <variable> [ NUMBER | CHAR | CHAR
(n [CHAR|BYTE]) |
VARCHAR2 (n [CHAR|BYTE]) | NCHAR | NCHAR (n) |
NVARCHAR2 (n) | CLOB | NCLOB | REFCURSOR |
BINARY_FLOAT | BINARY_DOUBLE ] ]

I can probably work around this issue by simulating the date as a string or long representation but I’m really curious why this is the case.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T17:21:37+00:00Added an answer on June 13, 2026 at 5:21 pm

    In PL/SQL, The KeyWord VARIABLE is out of your context. It used to create bind variables
    Bind variables are created in the environment and not in the declarative section of a PL/SQL block. Variables declared in a PL/SQL block are available only when you execute the block. After the block is executed, the memory used by the variable is freed. However, bind variables are accessible even after the block is executed. Therefore, when created, bind variables can be used and manipulated by multiple subprograms. They can be used in SQL statements and PL/SQL blocks just like any other variable. These variables can be passed as run-time values into or out of PL/SQL subprograms.

    eg for VARIABLE:

    VARIABLE b_result DATW
    BEGIN
      SELECT JOIN_DATE INTO :b_result
      FROM employees WHERE employee_id = 144;
    END;
    /
    PRINT b_result
    

    I feel for you, the blow will serve the purpose

    DECLARE
      some_date DATE;
    BEGIN
      -- other code
    END;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First let me say I'm fully aware sql server does not short circuit evaluate.
I am curious on how exactly LINQ (not LINQ to SQL) is performing is
I've always been curious of which method of SQL joining I should be using.
Curious if anybody has considered using EnumMap in place of Java beans, particularly value
I am curious on the most efficient way to query exclusion on sql. E.g.
the following text is an excerpt of oracle documentation Oracle® Database PL/SQL Language Reference
Just curious about SQL syntax. So if I have SELECT itemName as ItemName, substring(itemName,
I'm curious, is this result set can be achieved with sql query? Here is
After reading around, I've realized that SQL ( MySQL in my case ) does
I am curious to know how does paging work in asp.net? If my query

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.