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

  • SEARCH
  • Home
  • 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 7606611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T00:27:14+00:00 2026-05-31T00:27:14+00:00

I have an assignment problem that i can’t manage to fix and got totally

  • 0

I have an assignment problem that i can’t manage to fix and got totally stuck on.

I’ve got two tables (table1 and table2 which i created and filled with data:

CREATE TABLE Table1(
pnr VARCHAR2(11) PRIMARY KEY,
fnamn VARCHAR2(20),
enamn VARCHAR2(20),
bor_i VARCHAR2(20),
jobbar_i VARCHAR2(20));


CREATE TABLE Table2(
regnr VARCHAR2(6) PRIMARY KEY,
pnr REFERENCES bilägare(pnr),
tillverkare VARCHAR2(20),
modell VARCHAR2(20),
årsmodell NUMBER(4),
hk NUMBER(4),
datum DATE); 

Now i created a third table (table3) which I want to fill with data from table1 and table2 using an anonymous PL-SQL block and explicit cursor. I created the third table like this:

CREATE TABLE table3(
pnr VARCHAR2(11),
fnamn VARCHAR2(20),
enamn VARCHAR2(20),
regnr VARCHAR2(6),
tillverkare VARCHAR2(20),
modell VARCHAR2(20));

How can I fill it (table3) with data from table1 and table2? I also only want to fill it with data from those who have got more than 200 hk (have a look at table1). How do I manage to fix this? Thankful for all the help I can get.

  • 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-05-31T00:27:16+00:00Added an answer on May 31, 2026 at 12:27 am

    Thanks for your help 🙂 I solved it the following way

    declare
        cursor c_fartdåre
        is
           select pnr,
                  bilägare.fnamn,
                  bilägare.enamn,
                  fordon.regnr,
                  fordon.tillverkare,
                  fordon.modell
             from bilägare
            inner join fordon
            using (pnr)
            where fordon.hk > 200;
            c_fartdåre_rec c_fartdåre%rowtype;
    /*v_pnr         fordon.pnr%type;
    v_fnamn       bilägare.fnamn%type;
    v_enamn       bilägare.enamn%type;
    v_regnr       fordon.regnr%type;
    v_tillverkare fordon.tillverkare%type;
    v_modell      fordon.modell%type;*/
    begin
    
    if not c_fartdåre%isopen then
    open c_fartdåre;
    end if;
    
    loop
    fetch c_fartdåre into c_fartdåre_rec;
    exit when c_fartdåre%notfound;
    
      insert into fartdåre(pnr, fnamn, enamn, regnr, tillverkare, modell)
      values(c_fartdåre_rec.pnr, c_fartdåre_rec.fnamn, c_fartdåre_rec.enamn, c_fartdåre_rec.regnr, c_fartdåre_rec.tillverkare, c_fartdåre_rec.modell);
    end loop;
    
    
    commit;
    dbms_output.put_line('Kopieringen är klar!');
      end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Are there exceptions for types which can't have thier assignment operator overloaded? Specifically, I'm
There are N different classes that can be observed in my problem and my
I have a problem with an AJAX call that i make to login a
I have an assignment problem at hand and am wondering how suitable it would
I'm working on an assignment that is telling me to assume that I have
I have a graph-theoretic (which is also related to combinatorics) problem that is illustrated
I have got an assignment in which I have to implement a AS3 wrapper
I am hacking away at a uni assignment and have come across a problem
i have a problem, which i'm stuck with, and cant find anywhere to start
I know how to fix the problem that I am about to outline, however,

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.