| |

VerySource

 Forgot password?
 Register
Search
View: 1023|Reply: 7

Why can't such a script be executed in Oracle?

[Copy link]

2

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-2-7 07:00:02
| Show all posts |Read mode
SELECT * FROM TableName
where '10, 11, 13, 12, 40, 47, 48, 49, 90, 92, 91, 94, 95, 96, 30, 31, 33, 34, 35, 24, 20, 21' like '%' + menuid + ',%' order by menuid
The above paragraph I can execute normally in MS SQL, but I put an invalid number error in oracle. How should the above sentence be written in Oracle? menuid is a column in the table TableName, the record content in it may be 10 or 11 ....
Reply

Use magic Report

0

Threads

71

Posts

50.00

Credits

Newbie

Rank: 1

Credits
50.00

 China

Post time: 2020-3-28 01:45:02
| Show all posts
In oracle:

SELECT * FROM TableName
where munuid in (10,11,13,12,40,47,48,49,90,92,91,94,95,96,30,31,33,34,35,24,20,21 ') order by menuid;
Reply

Use magic Report

0

Threads

39

Posts

23.00

Credits

Newbie

Rank: 1

Credits
23.00

 China

Post time: 2020-4-4 00:30:01
| Show all posts
SELECT * FROM TableName
where menuid like '%' || variable || ',%' order by menuid
Reply

Use magic Report

0

Threads

39

Posts

23.00

Credits

Newbie

Rank: 1

Credits
23.00

 China

Post time: 2020-4-5 02:00:02
| Show all posts
sql server

drop table #a
create table #a (menuid varchar (20), aaa varchar (20))

insert into #a
select '10', 'aa'
union
select '20', 'bb'
union
select '30', 'bb'
union
select '11', 'bb'
union
select '210', 'bb'


SELECT * FROM #a
where '10, 11, 13, 12, 40, 47, 48, 49, 90, 92, 91, 94, 95, 96, 30, 31, 33, 34, 35, 24, 20, 21'
like '%' + menuid + ',%'
order by menuid

-
10aa
11bb
20bb
30bb
--lz what are you going to do?
Reply

Use magic Report

0

Threads

39

Posts

23.00

Credits

Newbie

Rank: 1

Credits
23.00

 China

Post time: 2020-4-5 09:00:01
| Show all posts
idpublic
 
 
   SELECT * FROM TableName
where menuid like '%' || variable || ',%' order by menuid


---------
I'm wrong
Finally understood the meaning of lz
Reply

Use magic Report

0

Threads

39

Posts

23.00

Credits

Newbie

Rank: 1

Credits
23.00

 China

Post time: 2020-4-6 13:00:01
| Show all posts
CREATE TABLE ta (menuid VARCHAR2 (20), aaa VARCHAR2 (20))

for connection in oracle ||
INSERT INTO ta
SELECT '10', 'aa' FROM dual
UNION
SELECT '20', 'bb' FROM dual
UNION
SELECT '30', 'bb' FROM dual
UNION
SELECT '11', 'bb' FROM dual
UNION
SELECT '210', 'bb' FROM dual



SELECT * FROM ta
WHERE '10, 11, 13, 12, 40, 47, 48, 49, 90, 92, 91, 94, 95, 96, 30, 31, 33, 34, 35, 24, 20, 21'
 LIKE '%' || TO_CHAR (menuid) || ',%' ORDER BY menuid
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-6-1 15:30:01
| Show all posts
oracle connector is ||, not +
Reply

Use magic Report

2

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

 Author| Post time: 2020-7-12 06:30:01
| Show all posts
I changed the method, but first collect, thank you very much!
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list