0

I need to create a query that when i enter partially the value of a parameter until"/" is shown it displays all the row sequences with that parameter in the first part before "/"

I enter as a parameter: pwd

The result of query should be: pwd/1 pwd/2 pwd/3....

2
  • Are you looking for this: where field like @pwd + '%'; Commented Aug 29, 2019 at 11:55
  • @KieranQuinn @pwd is not valid Oracle syntax. Were you meaning to use a bind variable :pwd or a substitution variable &pwd or just a PL/SQL variable pwd? Commented Aug 29, 2019 at 11:58

1 Answer 1

2

If you have a bind variable :parameter then:

SELECT *
FROM   table_name
WHERE  value LIKE :parameter || '/%'

So for some test data:

CREATE TABLE table_name ( id, value ) AS
  SELECT 1, 'pwd/1'     FROM DUAL UNION ALL
  SELECT 2, 'pwd/2'     FROM DUAL UNION ALL
  SELECT 3, 'pwdtest/1' FROM DUAL;

If :parameter is pwd then the output is:

ID | VALUE
-: | :----
 1 | pwd/1
 2 | pwd/2

db<>fiddle here

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.