Forum Stats

  • 3,733,521 Users
  • 2,246,780 Discussions
  • 7,856,752 Comments

Discussions

Inserting data into a table using SQL file.

r.khattri
r.khattri Member Posts: 47 Red Ribbon

Inserting data into a table using SQL file.

I created a SQL file with insert into....select....

When I am executing the file in SQL plus it's showing no. of records inserted.

But when I use select * from table....it show no rows.

Answers

  • Brett Calhoun
    Brett Calhoun Member Posts: 42 Bronze Badge

    Did you execute the "select * from table ..." from the same SQL Plus session? If not, did you execute a COMMIT after inserting your records?

    Brett

  • r.khattri
    r.khattri Member Posts: 47 Red Ribbon

    @Brett Calhoun Thank you. Issue resolved.

    In SQL file date format issue. Now its working.

    Only concern is when I executed same query from SQL Developer its working fine and inserting records. But when I am run .sql file from sqlplus its not showing any error over there.

    I found this error when I am executing same query from Oracle APEX SQL Workshop .

  • Brett Calhoun
    Brett Calhoun Member Posts: 42 Bronze Badge

    SQL Developer Web (Database Actions) auto commits. SQL Plus and SQL Developer do not by default auto commit; although you can change this setting in each.

    Glad you got it fixed.

    Brett

  • r.khattri
    r.khattri Member Posts: 47 Red Ribbon

    @Brett Calhoun Yes you are right. I did commit in SQL file as well as after execution of the script. But my concern is why it not throw error when I run the same insert ...into .....select... from sql developer.


    Thank you.

  • Brett Calhoun
    Brett Calhoun Member Posts: 42 Bronze Badge

    I do not know why it did not throw an error in SQL Developer. I'll need more information if you want me to investigate. Can you post a screen capture of the problem? And your SQL INSERT statements?

Sign In or Register to comment.