How can i escape a single character in a string query in a plsql block. I an tried escaping with double quotes but didn't seem to be working. I want to select data from a period of time and afterwards but the variable of date i have is in YYMM format and i am converting it to timestamp or datetime accordingly.
This is a sample of the code :
declare
datevar varchar2(4);
stringquery varchar(1000);
begin
stringquery := 'select * from mytable where datetimecol > to_timestamp('||datevar||',''YYMM'')';
For i in stringquery Loop
do sth