Display all object values in PLSQL










0















I am trying to display all the values in an object but it give me 'must be declared' error.



I tried the code below but still giving me same error.



declare
outN mytype;
begin
outN:= get_data();
dbms_output.put_line(outN.toString);
-- tried this as well
dbms_output.put_line(outN.ID);
dbms_output.put_line(outN.G);
dbms_output.put_line(outN.GES);
dbms_output.put_line(outN.CC);
dbms_output.put_line(outN.RR);

end;


And my object is:



 create or replace TYPE "mytype"
AS OBJECT
(
"ID" NUMBER(10),
"G" NUMBER(10),
"GES" VARCHAR(100 BYTE),
"CC" NUMBER(10),
"RR" VARCHAR(100 BYTE)
);


Errors:




Error report -
ORA-06550: line 5, column 38:
PLS-00302: component 'ID' must be declared
ORA-06550: line 5, column 7:
PL/SQL: Statement ignored
ORA-06550: line 6, column 38:
PLS-00302: component 'G' must be declared
ORA-06550: line 6, column 7:
PL/SQL: Statement ignored
ORA-06550: line 7, column 38:
PLS-00302: component 'GES' must be declared
ORA-06550: line 7, column 7:
PL/SQL: Statement ignored
ORA-06550: line 8, column 38:
PLS-00302: component 'CC' must be declared
ORA-06550: line 8, column 7:
PL/SQL: Statement ignored
ORA-06550: line 9, column 38:
PLS-00302: component 'RR' must be declared
ORA-06550: line 9, column 7:
PL/SQL: Statement ignored
06550. 00000 - "line %s, column %s:n%s"
*Cause: Usually a PL/SQL compilation error.




Another one:




Error report -
ORA-06550: line 5, column 38:
PLS-00302: component 'TOSTRING' must be declared
ORA-06550: line 5, column 7:
PL/SQL: Statement ignored
06550. 00000 - "line %s, column %s:n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:




get_data is just a function that return the result of a select statement (returns db rows)










share|improve this question
























  • What is toString? I don't see an attribute (or method) of type mytype in its definition. In any case, the first error will be thrown at the name of the type. You declared it as "mytype". In Oracle, when you use double-quotes, you are saying that you want case-sensitive identifiers. By default Oracle is not case sensitive; it will automatically convert mytype in your code block to MYTYPE, which will not match "mytype". Get in the habit of not using double-quoted identifiers, they only bring trouble. The alternative is in the declarations section to use double quotes.

    – mathguy
    Nov 14 '18 at 1:03












  • What is get_data(), also? There is a call to it in your code, but you haven't shown us what it is. ALSO: If you need help, you will have to include the exact error message(s) in your posts. Right now, the type MYTYPE is not declared (lower-case "mytype" is, which is different), but you will likely get more errors - tell us exactly what they are.

    – mathguy
    Nov 14 '18 at 1:07











  • edit my question

    – SMH
    Nov 14 '18 at 1:11






  • 1





    I am sorry, but I don't believe you. If you define the type "mytype" but you reference it without double-quotes, you will not get to the "undeclared components", you will get the error PLS-00201: identifier 'MYTYPE' must be declared first.

    – mathguy
    Nov 14 '18 at 1:45






  • 2





    Unless... did you also (perhaps in the past) create a type MYTYPE? Which may still exist in your schema (or a schema you have privileges to)? What do you get if you select * from ALL_TYPES where UPPER(type_name) = 'MYTYPE'?

    – mathguy
    Nov 14 '18 at 3:04















0















I am trying to display all the values in an object but it give me 'must be declared' error.



I tried the code below but still giving me same error.



declare
outN mytype;
begin
outN:= get_data();
dbms_output.put_line(outN.toString);
-- tried this as well
dbms_output.put_line(outN.ID);
dbms_output.put_line(outN.G);
dbms_output.put_line(outN.GES);
dbms_output.put_line(outN.CC);
dbms_output.put_line(outN.RR);

end;


And my object is:



 create or replace TYPE "mytype"
AS OBJECT
(
"ID" NUMBER(10),
"G" NUMBER(10),
"GES" VARCHAR(100 BYTE),
"CC" NUMBER(10),
"RR" VARCHAR(100 BYTE)
);


Errors:




Error report -
ORA-06550: line 5, column 38:
PLS-00302: component 'ID' must be declared
ORA-06550: line 5, column 7:
PL/SQL: Statement ignored
ORA-06550: line 6, column 38:
PLS-00302: component 'G' must be declared
ORA-06550: line 6, column 7:
PL/SQL: Statement ignored
ORA-06550: line 7, column 38:
PLS-00302: component 'GES' must be declared
ORA-06550: line 7, column 7:
PL/SQL: Statement ignored
ORA-06550: line 8, column 38:
PLS-00302: component 'CC' must be declared
ORA-06550: line 8, column 7:
PL/SQL: Statement ignored
ORA-06550: line 9, column 38:
PLS-00302: component 'RR' must be declared
ORA-06550: line 9, column 7:
PL/SQL: Statement ignored
06550. 00000 - "line %s, column %s:n%s"
*Cause: Usually a PL/SQL compilation error.




Another one:




Error report -
ORA-06550: line 5, column 38:
PLS-00302: component 'TOSTRING' must be declared
ORA-06550: line 5, column 7:
PL/SQL: Statement ignored
06550. 00000 - "line %s, column %s:n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:




get_data is just a function that return the result of a select statement (returns db rows)










share|improve this question
























  • What is toString? I don't see an attribute (or method) of type mytype in its definition. In any case, the first error will be thrown at the name of the type. You declared it as "mytype". In Oracle, when you use double-quotes, you are saying that you want case-sensitive identifiers. By default Oracle is not case sensitive; it will automatically convert mytype in your code block to MYTYPE, which will not match "mytype". Get in the habit of not using double-quoted identifiers, they only bring trouble. The alternative is in the declarations section to use double quotes.

    – mathguy
    Nov 14 '18 at 1:03












  • What is get_data(), also? There is a call to it in your code, but you haven't shown us what it is. ALSO: If you need help, you will have to include the exact error message(s) in your posts. Right now, the type MYTYPE is not declared (lower-case "mytype" is, which is different), but you will likely get more errors - tell us exactly what they are.

    – mathguy
    Nov 14 '18 at 1:07











  • edit my question

    – SMH
    Nov 14 '18 at 1:11






  • 1





    I am sorry, but I don't believe you. If you define the type "mytype" but you reference it without double-quotes, you will not get to the "undeclared components", you will get the error PLS-00201: identifier 'MYTYPE' must be declared first.

    – mathguy
    Nov 14 '18 at 1:45






  • 2





    Unless... did you also (perhaps in the past) create a type MYTYPE? Which may still exist in your schema (or a schema you have privileges to)? What do you get if you select * from ALL_TYPES where UPPER(type_name) = 'MYTYPE'?

    – mathguy
    Nov 14 '18 at 3:04













0












0








0








I am trying to display all the values in an object but it give me 'must be declared' error.



I tried the code below but still giving me same error.



declare
outN mytype;
begin
outN:= get_data();
dbms_output.put_line(outN.toString);
-- tried this as well
dbms_output.put_line(outN.ID);
dbms_output.put_line(outN.G);
dbms_output.put_line(outN.GES);
dbms_output.put_line(outN.CC);
dbms_output.put_line(outN.RR);

end;


And my object is:



 create or replace TYPE "mytype"
AS OBJECT
(
"ID" NUMBER(10),
"G" NUMBER(10),
"GES" VARCHAR(100 BYTE),
"CC" NUMBER(10),
"RR" VARCHAR(100 BYTE)
);


Errors:




Error report -
ORA-06550: line 5, column 38:
PLS-00302: component 'ID' must be declared
ORA-06550: line 5, column 7:
PL/SQL: Statement ignored
ORA-06550: line 6, column 38:
PLS-00302: component 'G' must be declared
ORA-06550: line 6, column 7:
PL/SQL: Statement ignored
ORA-06550: line 7, column 38:
PLS-00302: component 'GES' must be declared
ORA-06550: line 7, column 7:
PL/SQL: Statement ignored
ORA-06550: line 8, column 38:
PLS-00302: component 'CC' must be declared
ORA-06550: line 8, column 7:
PL/SQL: Statement ignored
ORA-06550: line 9, column 38:
PLS-00302: component 'RR' must be declared
ORA-06550: line 9, column 7:
PL/SQL: Statement ignored
06550. 00000 - "line %s, column %s:n%s"
*Cause: Usually a PL/SQL compilation error.




Another one:




Error report -
ORA-06550: line 5, column 38:
PLS-00302: component 'TOSTRING' must be declared
ORA-06550: line 5, column 7:
PL/SQL: Statement ignored
06550. 00000 - "line %s, column %s:n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:




get_data is just a function that return the result of a select statement (returns db rows)










share|improve this question
















I am trying to display all the values in an object but it give me 'must be declared' error.



I tried the code below but still giving me same error.



declare
outN mytype;
begin
outN:= get_data();
dbms_output.put_line(outN.toString);
-- tried this as well
dbms_output.put_line(outN.ID);
dbms_output.put_line(outN.G);
dbms_output.put_line(outN.GES);
dbms_output.put_line(outN.CC);
dbms_output.put_line(outN.RR);

end;


And my object is:



 create or replace TYPE "mytype"
AS OBJECT
(
"ID" NUMBER(10),
"G" NUMBER(10),
"GES" VARCHAR(100 BYTE),
"CC" NUMBER(10),
"RR" VARCHAR(100 BYTE)
);


Errors:




Error report -
ORA-06550: line 5, column 38:
PLS-00302: component 'ID' must be declared
ORA-06550: line 5, column 7:
PL/SQL: Statement ignored
ORA-06550: line 6, column 38:
PLS-00302: component 'G' must be declared
ORA-06550: line 6, column 7:
PL/SQL: Statement ignored
ORA-06550: line 7, column 38:
PLS-00302: component 'GES' must be declared
ORA-06550: line 7, column 7:
PL/SQL: Statement ignored
ORA-06550: line 8, column 38:
PLS-00302: component 'CC' must be declared
ORA-06550: line 8, column 7:
PL/SQL: Statement ignored
ORA-06550: line 9, column 38:
PLS-00302: component 'RR' must be declared
ORA-06550: line 9, column 7:
PL/SQL: Statement ignored
06550. 00000 - "line %s, column %s:n%s"
*Cause: Usually a PL/SQL compilation error.




Another one:




Error report -
ORA-06550: line 5, column 38:
PLS-00302: component 'TOSTRING' must be declared
ORA-06550: line 5, column 7:
PL/SQL: Statement ignored
06550. 00000 - "line %s, column %s:n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:




get_data is just a function that return the result of a select statement (returns db rows)







oracle plsql






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 14 '18 at 1:11







SMH

















asked Nov 14 '18 at 0:13









SMHSMH

69811024




69811024












  • What is toString? I don't see an attribute (or method) of type mytype in its definition. In any case, the first error will be thrown at the name of the type. You declared it as "mytype". In Oracle, when you use double-quotes, you are saying that you want case-sensitive identifiers. By default Oracle is not case sensitive; it will automatically convert mytype in your code block to MYTYPE, which will not match "mytype". Get in the habit of not using double-quoted identifiers, they only bring trouble. The alternative is in the declarations section to use double quotes.

    – mathguy
    Nov 14 '18 at 1:03












  • What is get_data(), also? There is a call to it in your code, but you haven't shown us what it is. ALSO: If you need help, you will have to include the exact error message(s) in your posts. Right now, the type MYTYPE is not declared (lower-case "mytype" is, which is different), but you will likely get more errors - tell us exactly what they are.

    – mathguy
    Nov 14 '18 at 1:07











  • edit my question

    – SMH
    Nov 14 '18 at 1:11






  • 1





    I am sorry, but I don't believe you. If you define the type "mytype" but you reference it without double-quotes, you will not get to the "undeclared components", you will get the error PLS-00201: identifier 'MYTYPE' must be declared first.

    – mathguy
    Nov 14 '18 at 1:45






  • 2





    Unless... did you also (perhaps in the past) create a type MYTYPE? Which may still exist in your schema (or a schema you have privileges to)? What do you get if you select * from ALL_TYPES where UPPER(type_name) = 'MYTYPE'?

    – mathguy
    Nov 14 '18 at 3:04

















  • What is toString? I don't see an attribute (or method) of type mytype in its definition. In any case, the first error will be thrown at the name of the type. You declared it as "mytype". In Oracle, when you use double-quotes, you are saying that you want case-sensitive identifiers. By default Oracle is not case sensitive; it will automatically convert mytype in your code block to MYTYPE, which will not match "mytype". Get in the habit of not using double-quoted identifiers, they only bring trouble. The alternative is in the declarations section to use double quotes.

    – mathguy
    Nov 14 '18 at 1:03












  • What is get_data(), also? There is a call to it in your code, but you haven't shown us what it is. ALSO: If you need help, you will have to include the exact error message(s) in your posts. Right now, the type MYTYPE is not declared (lower-case "mytype" is, which is different), but you will likely get more errors - tell us exactly what they are.

    – mathguy
    Nov 14 '18 at 1:07











  • edit my question

    – SMH
    Nov 14 '18 at 1:11






  • 1





    I am sorry, but I don't believe you. If you define the type "mytype" but you reference it without double-quotes, you will not get to the "undeclared components", you will get the error PLS-00201: identifier 'MYTYPE' must be declared first.

    – mathguy
    Nov 14 '18 at 1:45






  • 2





    Unless... did you also (perhaps in the past) create a type MYTYPE? Which may still exist in your schema (or a schema you have privileges to)? What do you get if you select * from ALL_TYPES where UPPER(type_name) = 'MYTYPE'?

    – mathguy
    Nov 14 '18 at 3:04
















What is toString? I don't see an attribute (or method) of type mytype in its definition. In any case, the first error will be thrown at the name of the type. You declared it as "mytype". In Oracle, when you use double-quotes, you are saying that you want case-sensitive identifiers. By default Oracle is not case sensitive; it will automatically convert mytype in your code block to MYTYPE, which will not match "mytype". Get in the habit of not using double-quoted identifiers, they only bring trouble. The alternative is in the declarations section to use double quotes.

– mathguy
Nov 14 '18 at 1:03






What is toString? I don't see an attribute (or method) of type mytype in its definition. In any case, the first error will be thrown at the name of the type. You declared it as "mytype". In Oracle, when you use double-quotes, you are saying that you want case-sensitive identifiers. By default Oracle is not case sensitive; it will automatically convert mytype in your code block to MYTYPE, which will not match "mytype". Get in the habit of not using double-quoted identifiers, they only bring trouble. The alternative is in the declarations section to use double quotes.

– mathguy
Nov 14 '18 at 1:03














What is get_data(), also? There is a call to it in your code, but you haven't shown us what it is. ALSO: If you need help, you will have to include the exact error message(s) in your posts. Right now, the type MYTYPE is not declared (lower-case "mytype" is, which is different), but you will likely get more errors - tell us exactly what they are.

– mathguy
Nov 14 '18 at 1:07





What is get_data(), also? There is a call to it in your code, but you haven't shown us what it is. ALSO: If you need help, you will have to include the exact error message(s) in your posts. Right now, the type MYTYPE is not declared (lower-case "mytype" is, which is different), but you will likely get more errors - tell us exactly what they are.

– mathguy
Nov 14 '18 at 1:07













edit my question

– SMH
Nov 14 '18 at 1:11





edit my question

– SMH
Nov 14 '18 at 1:11




1




1





I am sorry, but I don't believe you. If you define the type "mytype" but you reference it without double-quotes, you will not get to the "undeclared components", you will get the error PLS-00201: identifier 'MYTYPE' must be declared first.

– mathguy
Nov 14 '18 at 1:45





I am sorry, but I don't believe you. If you define the type "mytype" but you reference it without double-quotes, you will not get to the "undeclared components", you will get the error PLS-00201: identifier 'MYTYPE' must be declared first.

– mathguy
Nov 14 '18 at 1:45




2




2





Unless... did you also (perhaps in the past) create a type MYTYPE? Which may still exist in your schema (or a schema you have privileges to)? What do you get if you select * from ALL_TYPES where UPPER(type_name) = 'MYTYPE'?

– mathguy
Nov 14 '18 at 3:04





Unless... did you also (perhaps in the past) create a type MYTYPE? Which may still exist in your schema (or a schema you have privileges to)? What do you get if you select * from ALL_TYPES where UPPER(type_name) = 'MYTYPE'?

– mathguy
Nov 14 '18 at 3:04












1 Answer
1






active

oldest

votes


















2














Not sure what get_data() and toString are in your code. But, this should explain how object values can be displayed.



create or replace TYPE mytype -- removed double quotes
AS OBJECT
(
"ID" NUMBER(10),
"G" NUMBER(10),
"GES" VARCHAR2(100 BYTE), --Use VARCHAR2 instead of VARCHAR
"CC" NUMBER(10),
"RR" VARCHAR2(100 BYTE)
);
/
SET SERVEROUTPUT ON
DECLARE
outn mytype := mytype(1,10,'GES1',20,'RR1'); --declaration and assignment
BEGIN
dbms_output.put_line(outn.id);
dbms_output.put_line(outn.g);
dbms_output.put_line(outn.ges);
dbms_output.put_line(outn.cc);
dbms_output.put_line(outn.rr);
END;
/


Result



Type MYTYPE compiled

1
10
GES1
20
RR1


PL/SQL procedure successfully completed.





share|improve this answer























  • thanks @Kaushik, I am not sure why did you remove double quotes? My code is working fine with the double quotes but and returning the data fine with no error but the problem is to display the data of the object.

    – SMH
    Nov 14 '18 at 21:05











  • When I run your code I get : Error report - ORA-06550: line 6, column 38: PLS-00302: component 'ID' must be declared ORA-06550: line 6, column 7: PL/SQL: Statement ignored ORA-06550: line 7, column 38: PLS-00302: component 'G' must be declared ORA-06550: line 7, column 7: PL/SQL: Statement ignored ORA-06550: line 8, column 38: PLS-00302: component 'GES' must be declared

    – SMH
    Nov 14 '18 at 21:06











  • ORA-06550: line 8, column 7: PL/SQL: Statement ignored ORA-06550: line 9, column 38: PLS-00302: component 'CC' must be declared ORA-06550: line 9, column 7: PL/SQL: Statement ignored ORA-06550: line 10, column 38: PLS-00302: component 'RR' must be declared ORA-06550: line 10, column 7: PL/SQL: Statement ignored 06550. 00000 - "line %s, column %s:n%s" *Cause: Usually a PL/SQL compilation error. *Action:

    – SMH
    Nov 14 '18 at 21:06











  • @SMH : your error message indicates the the object has not been declared correctly. As you can see it works for me fine. Either there's something wrong with your get_data() function or you aren't showing us everything.

    – Kaushik Nayak
    Nov 15 '18 at 1:44










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53291343%2fdisplay-all-object-values-in-plsql%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









2














Not sure what get_data() and toString are in your code. But, this should explain how object values can be displayed.



create or replace TYPE mytype -- removed double quotes
AS OBJECT
(
"ID" NUMBER(10),
"G" NUMBER(10),
"GES" VARCHAR2(100 BYTE), --Use VARCHAR2 instead of VARCHAR
"CC" NUMBER(10),
"RR" VARCHAR2(100 BYTE)
);
/
SET SERVEROUTPUT ON
DECLARE
outn mytype := mytype(1,10,'GES1',20,'RR1'); --declaration and assignment
BEGIN
dbms_output.put_line(outn.id);
dbms_output.put_line(outn.g);
dbms_output.put_line(outn.ges);
dbms_output.put_line(outn.cc);
dbms_output.put_line(outn.rr);
END;
/


Result



Type MYTYPE compiled

1
10
GES1
20
RR1


PL/SQL procedure successfully completed.





share|improve this answer























  • thanks @Kaushik, I am not sure why did you remove double quotes? My code is working fine with the double quotes but and returning the data fine with no error but the problem is to display the data of the object.

    – SMH
    Nov 14 '18 at 21:05











  • When I run your code I get : Error report - ORA-06550: line 6, column 38: PLS-00302: component 'ID' must be declared ORA-06550: line 6, column 7: PL/SQL: Statement ignored ORA-06550: line 7, column 38: PLS-00302: component 'G' must be declared ORA-06550: line 7, column 7: PL/SQL: Statement ignored ORA-06550: line 8, column 38: PLS-00302: component 'GES' must be declared

    – SMH
    Nov 14 '18 at 21:06











  • ORA-06550: line 8, column 7: PL/SQL: Statement ignored ORA-06550: line 9, column 38: PLS-00302: component 'CC' must be declared ORA-06550: line 9, column 7: PL/SQL: Statement ignored ORA-06550: line 10, column 38: PLS-00302: component 'RR' must be declared ORA-06550: line 10, column 7: PL/SQL: Statement ignored 06550. 00000 - "line %s, column %s:n%s" *Cause: Usually a PL/SQL compilation error. *Action:

    – SMH
    Nov 14 '18 at 21:06











  • @SMH : your error message indicates the the object has not been declared correctly. As you can see it works for me fine. Either there's something wrong with your get_data() function or you aren't showing us everything.

    – Kaushik Nayak
    Nov 15 '18 at 1:44















2














Not sure what get_data() and toString are in your code. But, this should explain how object values can be displayed.



create or replace TYPE mytype -- removed double quotes
AS OBJECT
(
"ID" NUMBER(10),
"G" NUMBER(10),
"GES" VARCHAR2(100 BYTE), --Use VARCHAR2 instead of VARCHAR
"CC" NUMBER(10),
"RR" VARCHAR2(100 BYTE)
);
/
SET SERVEROUTPUT ON
DECLARE
outn mytype := mytype(1,10,'GES1',20,'RR1'); --declaration and assignment
BEGIN
dbms_output.put_line(outn.id);
dbms_output.put_line(outn.g);
dbms_output.put_line(outn.ges);
dbms_output.put_line(outn.cc);
dbms_output.put_line(outn.rr);
END;
/


Result



Type MYTYPE compiled

1
10
GES1
20
RR1


PL/SQL procedure successfully completed.





share|improve this answer























  • thanks @Kaushik, I am not sure why did you remove double quotes? My code is working fine with the double quotes but and returning the data fine with no error but the problem is to display the data of the object.

    – SMH
    Nov 14 '18 at 21:05











  • When I run your code I get : Error report - ORA-06550: line 6, column 38: PLS-00302: component 'ID' must be declared ORA-06550: line 6, column 7: PL/SQL: Statement ignored ORA-06550: line 7, column 38: PLS-00302: component 'G' must be declared ORA-06550: line 7, column 7: PL/SQL: Statement ignored ORA-06550: line 8, column 38: PLS-00302: component 'GES' must be declared

    – SMH
    Nov 14 '18 at 21:06











  • ORA-06550: line 8, column 7: PL/SQL: Statement ignored ORA-06550: line 9, column 38: PLS-00302: component 'CC' must be declared ORA-06550: line 9, column 7: PL/SQL: Statement ignored ORA-06550: line 10, column 38: PLS-00302: component 'RR' must be declared ORA-06550: line 10, column 7: PL/SQL: Statement ignored 06550. 00000 - "line %s, column %s:n%s" *Cause: Usually a PL/SQL compilation error. *Action:

    – SMH
    Nov 14 '18 at 21:06











  • @SMH : your error message indicates the the object has not been declared correctly. As you can see it works for me fine. Either there's something wrong with your get_data() function or you aren't showing us everything.

    – Kaushik Nayak
    Nov 15 '18 at 1:44













2












2








2







Not sure what get_data() and toString are in your code. But, this should explain how object values can be displayed.



create or replace TYPE mytype -- removed double quotes
AS OBJECT
(
"ID" NUMBER(10),
"G" NUMBER(10),
"GES" VARCHAR2(100 BYTE), --Use VARCHAR2 instead of VARCHAR
"CC" NUMBER(10),
"RR" VARCHAR2(100 BYTE)
);
/
SET SERVEROUTPUT ON
DECLARE
outn mytype := mytype(1,10,'GES1',20,'RR1'); --declaration and assignment
BEGIN
dbms_output.put_line(outn.id);
dbms_output.put_line(outn.g);
dbms_output.put_line(outn.ges);
dbms_output.put_line(outn.cc);
dbms_output.put_line(outn.rr);
END;
/


Result



Type MYTYPE compiled

1
10
GES1
20
RR1


PL/SQL procedure successfully completed.





share|improve this answer













Not sure what get_data() and toString are in your code. But, this should explain how object values can be displayed.



create or replace TYPE mytype -- removed double quotes
AS OBJECT
(
"ID" NUMBER(10),
"G" NUMBER(10),
"GES" VARCHAR2(100 BYTE), --Use VARCHAR2 instead of VARCHAR
"CC" NUMBER(10),
"RR" VARCHAR2(100 BYTE)
);
/
SET SERVEROUTPUT ON
DECLARE
outn mytype := mytype(1,10,'GES1',20,'RR1'); --declaration and assignment
BEGIN
dbms_output.put_line(outn.id);
dbms_output.put_line(outn.g);
dbms_output.put_line(outn.ges);
dbms_output.put_line(outn.cc);
dbms_output.put_line(outn.rr);
END;
/


Result



Type MYTYPE compiled

1
10
GES1
20
RR1


PL/SQL procedure successfully completed.






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 14 '18 at 3:38









Kaushik NayakKaushik Nayak

18.8k41330




18.8k41330












  • thanks @Kaushik, I am not sure why did you remove double quotes? My code is working fine with the double quotes but and returning the data fine with no error but the problem is to display the data of the object.

    – SMH
    Nov 14 '18 at 21:05











  • When I run your code I get : Error report - ORA-06550: line 6, column 38: PLS-00302: component 'ID' must be declared ORA-06550: line 6, column 7: PL/SQL: Statement ignored ORA-06550: line 7, column 38: PLS-00302: component 'G' must be declared ORA-06550: line 7, column 7: PL/SQL: Statement ignored ORA-06550: line 8, column 38: PLS-00302: component 'GES' must be declared

    – SMH
    Nov 14 '18 at 21:06











  • ORA-06550: line 8, column 7: PL/SQL: Statement ignored ORA-06550: line 9, column 38: PLS-00302: component 'CC' must be declared ORA-06550: line 9, column 7: PL/SQL: Statement ignored ORA-06550: line 10, column 38: PLS-00302: component 'RR' must be declared ORA-06550: line 10, column 7: PL/SQL: Statement ignored 06550. 00000 - "line %s, column %s:n%s" *Cause: Usually a PL/SQL compilation error. *Action:

    – SMH
    Nov 14 '18 at 21:06











  • @SMH : your error message indicates the the object has not been declared correctly. As you can see it works for me fine. Either there's something wrong with your get_data() function or you aren't showing us everything.

    – Kaushik Nayak
    Nov 15 '18 at 1:44

















  • thanks @Kaushik, I am not sure why did you remove double quotes? My code is working fine with the double quotes but and returning the data fine with no error but the problem is to display the data of the object.

    – SMH
    Nov 14 '18 at 21:05











  • When I run your code I get : Error report - ORA-06550: line 6, column 38: PLS-00302: component 'ID' must be declared ORA-06550: line 6, column 7: PL/SQL: Statement ignored ORA-06550: line 7, column 38: PLS-00302: component 'G' must be declared ORA-06550: line 7, column 7: PL/SQL: Statement ignored ORA-06550: line 8, column 38: PLS-00302: component 'GES' must be declared

    – SMH
    Nov 14 '18 at 21:06











  • ORA-06550: line 8, column 7: PL/SQL: Statement ignored ORA-06550: line 9, column 38: PLS-00302: component 'CC' must be declared ORA-06550: line 9, column 7: PL/SQL: Statement ignored ORA-06550: line 10, column 38: PLS-00302: component 'RR' must be declared ORA-06550: line 10, column 7: PL/SQL: Statement ignored 06550. 00000 - "line %s, column %s:n%s" *Cause: Usually a PL/SQL compilation error. *Action:

    – SMH
    Nov 14 '18 at 21:06











  • @SMH : your error message indicates the the object has not been declared correctly. As you can see it works for me fine. Either there's something wrong with your get_data() function or you aren't showing us everything.

    – Kaushik Nayak
    Nov 15 '18 at 1:44
















thanks @Kaushik, I am not sure why did you remove double quotes? My code is working fine with the double quotes but and returning the data fine with no error but the problem is to display the data of the object.

– SMH
Nov 14 '18 at 21:05





thanks @Kaushik, I am not sure why did you remove double quotes? My code is working fine with the double quotes but and returning the data fine with no error but the problem is to display the data of the object.

– SMH
Nov 14 '18 at 21:05













When I run your code I get : Error report - ORA-06550: line 6, column 38: PLS-00302: component 'ID' must be declared ORA-06550: line 6, column 7: PL/SQL: Statement ignored ORA-06550: line 7, column 38: PLS-00302: component 'G' must be declared ORA-06550: line 7, column 7: PL/SQL: Statement ignored ORA-06550: line 8, column 38: PLS-00302: component 'GES' must be declared

– SMH
Nov 14 '18 at 21:06





When I run your code I get : Error report - ORA-06550: line 6, column 38: PLS-00302: component 'ID' must be declared ORA-06550: line 6, column 7: PL/SQL: Statement ignored ORA-06550: line 7, column 38: PLS-00302: component 'G' must be declared ORA-06550: line 7, column 7: PL/SQL: Statement ignored ORA-06550: line 8, column 38: PLS-00302: component 'GES' must be declared

– SMH
Nov 14 '18 at 21:06













ORA-06550: line 8, column 7: PL/SQL: Statement ignored ORA-06550: line 9, column 38: PLS-00302: component 'CC' must be declared ORA-06550: line 9, column 7: PL/SQL: Statement ignored ORA-06550: line 10, column 38: PLS-00302: component 'RR' must be declared ORA-06550: line 10, column 7: PL/SQL: Statement ignored 06550. 00000 - "line %s, column %s:n%s" *Cause: Usually a PL/SQL compilation error. *Action:

– SMH
Nov 14 '18 at 21:06





ORA-06550: line 8, column 7: PL/SQL: Statement ignored ORA-06550: line 9, column 38: PLS-00302: component 'CC' must be declared ORA-06550: line 9, column 7: PL/SQL: Statement ignored ORA-06550: line 10, column 38: PLS-00302: component 'RR' must be declared ORA-06550: line 10, column 7: PL/SQL: Statement ignored 06550. 00000 - "line %s, column %s:n%s" *Cause: Usually a PL/SQL compilation error. *Action:

– SMH
Nov 14 '18 at 21:06













@SMH : your error message indicates the the object has not been declared correctly. As you can see it works for me fine. Either there's something wrong with your get_data() function or you aren't showing us everything.

– Kaushik Nayak
Nov 15 '18 at 1:44





@SMH : your error message indicates the the object has not been declared correctly. As you can see it works for me fine. Either there's something wrong with your get_data() function or you aren't showing us everything.

– Kaushik Nayak
Nov 15 '18 at 1:44

















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53291343%2fdisplay-all-object-values-in-plsql%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

Barbados

How to read a connectionString WITH PROVIDER in .NET Core?

Node.js Script on GitHub Pages or Amazon S3