Click here to Skip to main content
15,892,674 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
SQL
INSERT INTO GROUPS(GROUP_ID, GROUP_NAME,DEPT_ID) VALUES(1176,'dhkjh',SELECT DEPARTMENT_ID FROM PERSONNEL_TEMP.DEPARTMENT WHERE DEPARTMENT_NAME='خدمات')
Posted
Updated 23-Jun-15 20:29pm
v2

1 solution

By exchanging the insert parameters and the condition parameter for Bind variables like this:
SQL
INSERT INTO GROUPS (GROUP_ID, GROUP_NAME,DEPT_ID)
VALUES(:GROUP_ID,:GROUP_NAME,SELECT DEPARTMENT_ID FROM PERSONNEL_TEMP.DEPARTMENT WHERE DEPARTMENT_NAME = :DEPARTMENT_NAME)
 
Share this answer
 
Comments
Suvendu Shekhar Giri 24-Jun-15 2:31am    
+5. Simple and straight solution.
Member 11788124 24-Jun-15 2:42am    
and where i define DEPARTMENT_NAME?
Jörgen Andersson 24-Jun-15 3:00am    
Depends on how you use it.

What Language are you calling from?
Jörgen Andersson 24-Jun-15 3:04am    
There's an example for C# here: http://docs.oracle.com/cd/B25329_01/doc/appdev.102/b25312/building_odp.htm#CEGCGDAB

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900