I'm trying to build a search page in ASP.NET that allows me to search for table names in oracle. When I place the sql in the sqldatasource control it doesn't recognize the parameter :Tablename. How do I need to rewrite this so that it works?
SELECT Owner, Table_name, Num_Rows, Tablespace_name
FROM all_tables
WHERE trim(upper(table_name)) LIKE trim(upper('%:TableName%'))
the LIKE operation is not permitted to be used with IN.
You can also using the % wildcard multiple times within the same string. For example, SELECT last_name FROM customers WHERE last_name LIKE '%er%';
Description. The SQL LIKE condition allows you to use wildcards to perform pattern matching in a query. The LIKE condition is used in the WHERE clause of a SELECT, INSERT, UPDATE, or DELETE statement.
Can you replace
'%:TableName%'
with
'%' || :TableName || '%'
?
For those that might be interested: For SQL Server embedding the % into the parameter's text like this works: (The other method described above doesn't)
WHERE trim(upper(table_name)) LIKE trim(upper(@TableName))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With