Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7876173
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:07:38+00:00 2026-06-03T03:07:38+00:00

I have 2 tables, Facilities and Services . CREATE TABLE Facilities ( facility_id NUMBER(2)

  • 0

I have 2 tables, Facilities and Services.

CREATE TABLE Facilities (
facility_id NUMBER(2) NOT NULL,
facility_name VARCHAR2(20) NOT NULL,
CONSTRAINT pk_facil_id PRIMARY KEY (facility_id)
);

CREATE TABLE Services (
service_id NUMBER(2) NOT NULL,
service_name VARCHAR(20) NOT NULL,
service_facility NUMBER(2) NOT NULL,
CONSTRAINT pk_serviceid PRIMARY KEY (service_id)
);

ALTER TABLE Services
add CONSTRAINT fk_servicefacility FOREIGN KEY(service_facility) 
REFERENCES Facilities(facility_id);

If I try entering records into the ‘Services’ table like so:

INSERT INTO Services (service_id, service_name, service_facility) 
SELECT 06, 'Rooms', 
(SELECT facility_id, FROM Facilities WHERE facility_name = 'Hotel') 
FROM Dual;

I get an error “missing expression” for 3 out of the 7 insert statements. What expression is missing?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T03:07:39+00:00Added an answer on June 3, 2026 at 3:07 am

    The SQL statement you posted has an extra comma. If you run the statement in SQL*Plus, it will throw the ORA-00936: missing expression and show you exactly where the error occurs

    SQL> ed
    Wrote file afiedt.buf
    
      1  INSERT INTO Services (service_id, service_name, service_facility)
      2  SELECT 06, 'Rooms',
      3  (SELECT facility_id, FROM Facilities WHERE facility_name = 'Boston')
      4* FROM Dual
    SQL> /
    (SELECT facility_id, FROM Facilities WHERE facility_name = 'Boston')
                         *
    ERROR at line 3:
    ORA-00936: missing expression
    

    If you remove the comma, the statement works

    SQL> ed
    Wrote file afiedt.buf
    
      1  INSERT INTO Services (service_id, service_name, service_facility)
      2  SELECT 06, 'Rooms',
      3  (SELECT facility_id FROM Facilities WHERE facility_name = 'Boston')
      4* FROM Dual
    SQL> /
    
    1 row created.
    

    Note, however, that I would generally prefer Stefan’s syntax where you are selecting from Facilities rather than selecting from dual with a scalar subquery.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have tables in a MySQL database like this... CREATE TABLE `someUserTable` ( userId
I have tables linked by FK, I query on the first table using entity
I have three tables A: A.pID primary key, A.Name nvarchar(250) B: B.pID primary key,
I have tables named: Posts_August_2011 Posts_September_2011 Posts_October_2011 Posts_November_2011 Posts_December_2011 Posts_January_2012 I want to create
I have three tables called: users , facilities , and staff_facilities . users contains
I have tables of data samples, with a timestamp and some data. Each table
I have tables named Events and Log. The Events table comprises of ID, Event
I have a form where the user must select a large number of facilities
I have two tables, say Table A and Table B. I want to have
I have a table with the following structure, FIELD TYPE EXTRA faciltiy_id int auto_increment(Primary

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.