-2

Good morning

In one table. I have LOADDATETIME column name- DATE datatype.. And value will be in the "13/06/2022 18:46:23"

I need to delete rows in the table by using Loaddatetime column..

How can I delete. Could u pls tell anyone

1 Answers1

1

It is kind of unclear what you actually have. Title mentions "PL/SQL" which reads as "Oracle" (it is procedural extension to its SQL). Tags you used (PL/SQL Developer and TOAD) are just tools we use to access various databases - and it doesn't have to be Oracle. Code depends on database you use, not a tool.

Anyway, I'll presume you do use Oracle (and suggest you to fix tags and be more specific next time).


This ("13/06/2022 18:46:23") is just representation of that column's value; Oracle stores it in its internal format (irrelevant for this discussion).

If you want to delete rows regarding to loaddatetime column, then it should be part of the where clause.

There are various options; you never said what exactly you want to delete, so here are a few examples.

To delete rows with exactly that date value (use to_date function which will - according to provided format model - convert that string into a valid date datatype value):

delete from your_table 
where loaddatetime = to_date('13/06/2022 18:46:23', 'dd/mm/yyyy hh24:mi:ss');

To delete rows between two dates (I'm using date literals in this case):

delete from your_table
where loaddatetime between date '2022-06-01' and date '2022-06-15';

And so forth; for a more precise suggestion, be more specific.

Littlefoot
  • 131,892
  • 15
  • 35
  • 57