Skip to content

Oracle PL/SQL Functions: “Invalid Datatype”

The following function checks to see if a zip code is present in a table called ZIPCODE: The schema for the ZIPCODE table is as follows: To test this function, I issued the following statement which should return false as the zip code passed as an argument is present in the ZIPCODE table: However, I receive t…

How to do division in SQL query between two column

In the above image I have 4 column and I am trying to get the average value of criticality and Priority by dividing it by the totalNumber. But for some reason my query is not working and I also trying to just get one decimal place after the division. My sql query: Answer Try to use cast(round(criticality/tota…

How to prevent sql without limit in Hive?

Many users are used to using ‘select * from tables’ in oracle/mysql But i should not allow them to query like that in hive Is there any way to prevent a full_table scan in hive? Like trigger or somethng else? Thanks a lot! Answer To prevent full table scan use these settings. Hive will generate ex…

Order by SQL line

How would I go about creating an SQL line that puts each car from new to old (Years) but also keeps it in alphabetical order For example it needs to do this This is how its displaying MY View Answer You may try the following query: The call I make to SUBSTRING_INDEX extracts the second word from the model str…

java netbean inserting data to db does not work

I’m trying to insert data to data base by my own interface using java netbean But I’m stuck with insert query doesn’t work here is my code segment st.executeUpdate(query) mark as wrong. Answer Ok, let me explain your problem. You don’t have configured jdbc driver. Don’t need to cast anything…