PLS-00103 Met the symbol & ldquo; BEGIN & rdquo;

This may be a repeat question but I'm very new with pl sql so I'm going to ask it anyways. I wrote a function that is supposed to determine if a varchar2 contains all alpha characters. It is defined as... CREATE OR REPLACE FUNCTION isAlpha (al IN VAR

using group by in the sql subquery

how to get around this error : Unable to use an aggregate or a subquery in an expression used in the GROUP BY list of a GROUP BY clause. here is my query : select Id, name,dayA,monthA,yearA, sum(x) as x, (select SUM(x) group by month) as total, from

Codeigniter SUM and LEFT JOIN when deleting duplicates

I am left joining 4 tables to get SUM of the amount that is present in first table. So far, I've tried many alternatives to get the sum straight, but either it becomes 0 (if I group_by), or duplicates, if I don't use group_by. here is my code: $this-

Attach the result of a Temp column to a SQL Server table

I am using SQL Server to create my database. I want to add a column to my Table which would calculate the number of NULL values in each row, like this: Column1 | Column2 | Column3 | Score a | B | C | 0 x | NULL | NULL | 2 Currently, I have this: Colu

How to insert lines in a loop

I have the following plpgsql function in PostgreSQL: CREATE OR REPLACE FUNCTION func1() RETURNS SETOF type_a AS $BODY$ declare param text; sqls varchar; row type_a; begin code..... sqls='select * from func3(' || param || ') '; for row in execute sqls

Yes or No following a sql request without using IF or CASE

Is there a way to make a query and return 'yes' or 'no' as an answer without the use of Flow Control operators? The only solution I thought is: select 'yes' as answer from blabla where blabla but this of course works only if the query found some resu

How to get empty cell lines in mssql

I have been trying to get the rows where cell is empty but how can i get an empty cell Its not NULL over there, its like an empty string. 05J9LJ-E E004030 BGH/F.TB E004032 000080.KS 002X87-E E004033 018880.KS So second row, first column is like 8 spa

SQL to search a table and make a record by field

I have three tables in my database. Table one effectively contains two fields: |Datetime| |Set| Table two is a lookup table which matches a number of parts of a set to a set number: |Set| |Part1| |Part2| |Part3| |Part4| I want table 3 to have a recor

sql server insert copy rows multiple tables a field change

I'm not sure of the best way to ask this, so it will be through example. I have a good size database that contains about 800 tables each containing a key piece of information for all data - For the example we'll call it Department. This is part of th

How to retrieve specific rows from the SQL Server table?

I was wondering is there a way to retrieve, for example, 2nd and 5th row from SQL table that contains 100 rows? I saw some solutions with WHERE clause but they all assume that the column on which WHERE clause is applied is linear, starting at 1. Is t

View data in Crystal Reports when multiple DataSet tables

I am using Crystal Report with VS 10, I have added DataSet. Now if There's only One Table in DataSet then data is being displayed, while if i add Two Tables with Link, then Data is not being display. And i am taking fields from this table of DataSet(

Summation and order at once

I have a table of orders. There I need to find out which 3 partner_id's have made the largest sum of amount_totals, and sort those 3 from biggest to smallest. testdb=# SELECT amount_total, partner_id FROM sale_order; amount_total | partner_id -------

have a sum in the nested selection

I have two tables: one is Tour and other is ReservedTour. The columns of the tables are: Tour | ReservedTour ===========|============= id | id city | Tid capacity | number timeout | . . | . . | . . | ========== |====== I write an SQL statement such a

PHP linking a wildcard

Hope Somebody will help me about how I bind a parameter in mysqli when a multiple character wildcard needs to be next to the variable value. I found that it worked for me when creating a SQL statement, like this: $sql = "SELECT item_title FROM item W

C # database problem

Could somebody tell me why this isn't adding the values to the database. The form runs fine and doesn't return any errors. private void button1_Click(object sender, EventArgs e) { SqlConnection connection = new SqlConnection(); SqlCommand command = n

Insert date / time in the Access database

I'm using ASP.NET/VB and I'm trying to insert a date and time into an Access date/time field, but I'm getting an error (Data type mismatch in criteria expression). Here's a simplified version of my code: Dim myDate As Date = Now() Dim myIns1 As New O

Suppression with GROUP BY

How do I change this SELECT so it is the criteria used for deleting? SELECT COUNT(empid), empid, status, deptid from tableA GROUP BY empid, status, deptid HAVING status is null and deptid = 5 What do you want to delete? If simply records with NULL st

Return the number in text format

Possible Duplicate: How can I convert an integer into its verbal representation? I am looking for some solution to return a number as text. By that I mean that 100 should be returned as 'one hundred' It is more or less just a tidious task to make suc

Mysql multiplication operation

How to execute Multiplication Operation in a Mysql Query? If my query is like this : "SELECT registration.hosteladmissionno, registration.student_name, registration.semester, student_month.hosteladmissionno, student_month.student_name, student_month.

Derby INSERT SELECT null pointer exception

I'm writing a Java application that's working with Apache Derby via JDBC. I'm having problems with the code in the following snippet: byte md5[] = md5sum(file); PreparedStatement s = con.prepareStatement("INSERT INTO input_files (job_ID, hash) SELECT

How to set the set for an IN statement using SQL inline?

Possible Duplicate: Parameterizing a SQL IN clause? Hi, I have a query looks like this: SELECT CompanyId FROM CompanyTable WHERE CompanyName IN ('Subway', 'A & W', 'Pizzahut') Is there any way I can use sql parameters for the names list? This is not

SQLite swivel table, setwise like SQL should be

I have some data. 224,000 rows of it, in a SQLite database. I want to extract time series information from it to feed a data visualisation tool. Essentially, each row in the db is an event that has (among other things not strictly relevant) a time-da