Javatpoint Logo

Error - SP2-0678: Column or attribute type cannot be displayed by SQL*Plus

By: rickys*** On: Fri Nov 22 23:54:35 EST 2013     Question Reputation5 Answer Reputation0 Quiz Belt Series Points0  5Blank User
Ques 1) I am compile & run the below program and i am getting the following error

Eroor - SP2-0678: Column or attribute type can not be displayed by SQL*Plus

Note - I am using oracle 10g database.

Prog -

import java.sql.*;
import java.io.*;

class InsertImage
{
public static void main(String args[])
{
try
{
Class.forName("oracle.jdbc.driver.OracleDriver");

Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "system", "oracle");

PreparedStatement ps = con.prepareStatement("insert into imgtable values(?, ?)");

FileInputStream fin = new FileInputStream("F:\\Javatpoint Example\\JDBC\\d\\g.jpg");

ps.setString(1, "Sonoo");
ps.setBinaryStream(2, fin, fin.available());

int i = ps.executeUpdate();
System.out.println(i + " records affected");

con.close();
}
catch(Exception e)
{
e.printStackTrace();
}
}
}

I am creating the table

create table imgtable(name varchar2(4000), photo blob);

then compile the above program

javac InsertImage.java
java InsertImage

Output - 1 records affected

Now i am execute the query at run sql command line

select * from imgtable;

then i am getting the following error

SP2-0678: Column or attribute type can not be displayed by SQL*Plus

Now i am using another query

select name from imgtable;

this query works fine But

select photo from imgtable;

this query is not work and not show the image.

Solve this problem
Up0Down

 

Cause: The type specified is not supported.

you should Rewrite the query to select the data with types that SQL*Plus supports.


To solve this issue just select the key columns with data type VARCHAR2 (or any other column but not DATA) and it should work.
Image Created0Down

By: [email protected] On: Sat Nov 23 05:08:07 EST 2013 Question Reputation0 Answer Reputation392 Belt Series Points0 392User Image
Are You Satisfied :2Yes3No