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

  • Home
  • SEARCH
  • 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 9062337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T15:42:47+00:00 2026-06-16T15:42:47+00:00

I Defined the following procedure which compiles correctly. http://pastebin.com/pBHFctHq When i call that procedure

  • 0

I Defined the following procedure which compiles correctly.

http://pastebin.com/pBHFctHq

When i call that procedure it returns an error:

ERROR 1292 (22007): Incorrect date value: ''2012-12-30'' for column 'date_part' at row 11

I think the problem is fetching the date from the cursor, how would i solve it??

small description of the code: i am looping through different tables , and gathering information on each partition that may exist in the table (each table is range partitioned by date)

  • 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-16T15:42:48+00:00Added an answer on June 16, 2026 at 3:42 pm

    I think you are comparing string with date that’s why you are getting error..
    you can use this for comparision:

               TO_DATE(PARTITION_DESCRIPTION,'YYYY-MM-DD')      // in oracle this will work
    
               STR_TO_DATE(PARTITION_DESCRIPTION, '%Y-%m-%d')   // in mysql this will work
    
               convert(varchar(20),PARTITION_DESCRIPTION,104)   // in ms-sql this will work
    

    so your code look like this:

       BLOCK2: BEGIN
                                DECLARE loop1_eof INT DEFAULT FALSE;
    
                                DECLARE cur1 CURSOR FOR SELECT TO_DATE(PARTITION_DESCRIPTION,'YYYY-MM-DD')
                                FROM INFORMATION_SCHEMA.PARTITIONS
                                WHERE TABLE_NAME=tmp_title AND TABLE_SCHEMA='test1';    
                                DECLARE CONTINUE HANDLER FOR NOT FOUND SET loop1_eof = TRUE;
    
                                OPEN cur1;
                                loop1: LOOP
                                        FETCH cur1 INTO date_part;
                                        SELECT max(id) from `test1`.tmp_title where CurrentDate < date_part;
                                        IF loop1_eof THEN
                                                CLOSE cur1;
                                                LEAVE loop1;
                                        END IF;
                                END LOOP loop1;
                        END BLOCK2;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a database stored procedure call that, among other columns, returns a column
To follow typical COM procedure, whenever any error occurs, one must do the following:
I have defined the following class using COM to use the IGroupPolicyObject using C#.NET:
I have the following stored procedure defined: CREATE OR REPLACE PROCEDURE NOTIFY_INSERT ( FLAG
I saw this question (http://stackoverflow.com/questions/1521640/standard-android-button-with-a-different-color) and that works fine for normal buttons. Now I
I have defined the following procedure successfully in my database, but somehow it doesn't
I have the following code that runs a stored procedure repeatedly. It works pretty
I have to create the following: A Scheme procedure named 'proc2' which takes 4
I have a SP prc_Foo_Delete which has the following signature: ALTER PROCEDURE [prc_Foo_Delete] @fooIds
I have the following stored procedure that I am trying to convert to a

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.