0

I'm new to database and form builder .

I'm getting:

Error 103 at line 10, column 2
Encountered the symbol "SELECT"...

Whats the correct syntax for that please?

INSERT INTO vehicle (
                     vehicleid, reg_no, year, fuel, 
                     engine_capacity, transmission, seat_capacity, rice_per_day, 
                     modelid, policy_id, type_name, color
                    )
VALUES (:vehicle_block.id, 
        :vehicle_block.reg_no, 
        :vehicle_block.year,
        :vehicle_block.fuel, 
        :vehicle_block.cc, 
        :vehicle_block.transm,
        :vehicle_block.seat, 
        :vehicle_block.price_p_day,
        (SELECT modelid
           FROM model m 
          WHERE m.make = :vehicle_block.make
            AND m.mode_name = :vehicle_block.model),
        :vehicle_block.policy, 
        :vehicle_block.type,
        :vehicle_block.color);
COMMIT;
7
  • 2
    Current syntax is wrong. You can rearrange as INSERT INTO .... SELECT :VEHICLE_BLOCK.ID, :VEHICLE_BLOCK.REG_NO, :VEHICLE_BLOCK.YEAR, :VEHICLE_BLOCK.FUEL, :VEHICLE_BLOCK.CC, :VEHICLE_BLOCK.TRANSM, :VEHICLE_BLOCK.SEAT, :VEHICLE_BLOCK.PRICE_P_DAY, MODELID, :VEHICLE_BLOCK.POLICY, :VEHICLE_BLOCK.TYPE, :VEHICLE_BLOCK.COLOR FROM model M WHERE m.make = :VEHICLE_BLOCK.MAKE AND m.model_name = :VEHICLE_BLOCK.MODEL if sure that make and model_name combination always returns single row. Commented Jan 6, 2023 at 16:47
  • 1
    Why did you post that as a comment, @Barbaros? As of actual comment you wrote, it doesn't really matter whether MAKE and MODEL_NAME return a single row. If not, that INSERT statement will insert multiple rows - it won't fail (unless some constraint is violated, that is). Commented Jan 6, 2023 at 19:22
  • Yes, you're right @Littlefoot I've just missed the part that returning multiple rows wouldn't corrupt the logic after arrangement. Commented Jan 7, 2023 at 5:20
  • 1
    @Thorsten, it is about Oracle Forms. :vehicle_block.id isn't a bind variable. VEHICLE_BLOCK represents block name (region in Apex), while ID represents field (item in Apex) that belongs to that block. Colon in front of it is part of Forms' syntax (something like :P1_ID in Apex). Commented Jan 7, 2023 at 11:51
  • 1
    @MichaelJF, I was replying to Thorsten (as you can see). As I know that Thorsten uses Apex (Oracle Application Express), I was trying to illustrate what certain Forms objects represent in Apex because (seeing his comment) it is clear that he doesn't know Forms; if he did, he wouldn't ask what e.g. :vehicle_block.id represents. Commented Jan 16, 2023 at 19:37

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.