I’m attempting to write a query script where I declare a variable and then use them in a select statement in Oracle SQL. Basically script should check if parent tables’ entries are used in referenced table or not. if not –> delete the entry from REF table. So far I have this So far LOG_MSG(‘Parent table: ‘ || tableName.table_name ||
Tag: types
Create Table variable datatype that would allow to save integer/floats [SQL]
as the title states, when creating a table, when definining an variable + datatype like: Question: You can define a variable as integer or as float etc. however, is there a datatype that can hold both values, integer as well as a float number ? Answer Some databases support variant data types that can have an arbitrary type. For instance,
Error converting data type nvarchar to numeric convert/cast
I suspect this has to do with reporting ClientName, which is a nvarchar data type. AUMid is nchar. I’m not sure how to work around this without changing the data types (which I prefer not to). I need to display Clients.ClientName. It is linked to the AUM table via AUM.AUMid. Removing SUM(AUM.AUM * AUM.ManagementFee) AS Management_Fee allows the query to
Changing data type to float and rounding to 2 decimal digits
Tables: Goal: Display each unique job, the total average salary (FLOAT and rounded to 2 decimal places), the total people and the total salary (Float and rounded to 2 decimal places) and order by highest average salary. So the challenge is to keep the cast type as float while rounding it to 2 decimal places. I’ve gotten to where I’ve
CREATE TYPE on MySQL
I couln’t create a new data type on MySQL. Query is given below How can I do that on MySQL Answer You cannot. MySQL doesn’t have user-defined types. (At least, not in current versions.)
Change PostgreSQL columns used in views
I would like PostegreSQL to relax a bit. Every time I want to change a column used in a view, it seems I have to drop the view, change the field and then recreate the view. Can I waive the extra protection and just tell PostgreSQL to let me change the field and then figure out the adjustment to the
Database Data Types and their equivelants in Windows Forms
I’ve read in forums about people having issues with certain data types when accessing a database from their website and windows forms application. Mostly the decimal, float and datetime data types. My DB Table, for example, the Orders table consists of the following Columns. Below each column is the datatype I have chosen to use: My questions are: Is (in
For VAT tax, what is the correct Decimal(p, s) precision and scale for SQL Server field size declaration?
I am defining VAT rates (European and other countries levy the VAT tax) in a SQL Server database and am wondering what the ideal decimal definition to capture the necessary precision. I have seen VAT rates of: I am curious if there are cases where the VAT rate requires more precision than decimal(4, 3) where p is precision and s
How to use money data type in Java, SQL, ORM
What are best practises in using money data type in Java application? Money should be in double variable? What about rounding, currencies and so on. Are special libraries for this? And what about ORM and SQL in most popular databases. As I know not in all SQL engines is Money data type. In that case NUMERIC(15,2), DECIMAL(15,2) or REAL data
Return multiple fields as a record in PostgreSQL with PL/pgSQL
I am writing a SP, using PL/pgSQL. I want to return a record, comprised of fields from several different tables. Could look something like this: CREATE OR REPLACE FUNCTION get_object_fields(name text)…