Select statement where column not equal to number
Hi experts,
I have a column amount
id amount
1 123.0000000000
2 33344.0000
3 66666.36220000000000000000
4 2122222.7878789799999
5 444444444
6 .000000000000000000000
7 wweeeeeeeeeerr
8 eeeeeeeeeeeeeet
I want to get :
id amount
7 wweeeeeeeeeerr
8 eeeeeeeeeeeeeet Thanks in advance
i am getting my amount from txt file
Iam loading that into external files and then to the database tables
intially i will get amount(it should have only numbers) as varchar2
(But , when iam loading into tabes i will convert that into number using CAST function.)
When loading , Iam getting invalid number error
Similar Messages
-
Select statement - Where Condition not possible
Hi,
I am trying to extract data from sap standard table CFX_COL.I want extract based on a field which is of type string.I can see that in the table but when I code below I am getting error.Any other alterantives?
REPORT x.
TABLES:proj.
DATA: it_proj TYPE STANDARD TABLE OF proj.
DATA:wa_proj TYPE proj.
DATA: it_cfol TYPE STANDARD TABLE OF CFX_COL.
DATA:wa_cfol TYPE CFX_COL.
data:v_name type STRING.
PARAMETERS: p_pspid LIKE proj-pspid.
SELECT * FROM proj INTO CORRESPONDING FIELDS OF TABLE it_proj
WHERE pspid = p_pspid.
READ TABLE it_proj INTO wa_proj INDEX 1.
concatenate wa_proj-pspid '-' wa_proj-post1 into v_name.
select * from CFX_COL into CORRESPONDING FIELDS OF TABLE it_cfol
where name in v_name.
Error:The Field "NAME" is a long string , so it cannot be used in WHERE, ON or HAVING conditions.
Rgds
VaraHi Vara.
Select will not work if you are trying to search based on the name field as in the table CFX_COL it has data type String which basically is not content but a reference to a storage area and internally it is stored in a different format not searchable. Even , if you try to find the number of entries in the table you can not put any value in this field as it will not be available for input as it doesn't contain any value.
STRING: Character string with variable length This data type can only be used in types (data elements, structures, table types) and domains. In the Dictionary a length can be specified for this type (at least 256 characters). It may be used in database tables, however, only with restrictions. For a description of them refer to the documentation of the ABAP statement 'STRING' . In ABAP, this type is implemented as a reference to a storage area of variable size. As default for the output length 132 characters are proposed. You cannot attach search helps to components of this type.
http://help.sap.com/saphelp_40b/helpdata/en/cf/21f2e5446011d189700000e8322d00/content.htm
Regards
Apoorva -
Argument error; the number of columns does not equal the number of parameters.
I am using the Database Toolkit (Enterprise Connectivity) to check for a network connection and then send information from a local database to a SQL database on the network if needed. In development of the code I continue to receive Error 1 and the Possible Reason(s) is "Argument error; the number of columns does not equal the number of parameters." I am using the DBToolsSelectData.VI to retrieve data from the local MDB file and the DBToolsInsertData.VI to write it to the SQL file. The collection of the data from the MDB file is successful and the connection and validation of the table and columns in the SQL file is also successful. The error occurs when the Insert VI tries to build the query. The number of columns being written (attempted) does match the number of columns in the data, they are both 16 string arrays.
Ok, it's taken a bit, and I have a solution! It took a while to figure out what the DCT is doing, but it seems to be working now.
The reason for the original error is that you were passing into the insert subVI an array of variants - which the input to the VI coerced into a single variant. You were getting the error because as far as the insert VI was concerned you were only passing it a single data value. The way to get around that was to create a cluster with one element for each column value, convert the cluster to a variant and pass the result to the insert VI - see attachment.
In terms of the other modifications, I made a copy of the endurance.mdb file, emptied it and used it as the destination for the copy.
Mike...
Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion
"... after all, He's not a tame lion..."
Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps
Attachments:
NetworkCheck.vi 49 KB -
How to speed a select statement with the NOT EXISTS where condition ?
Hi all,
I created a view : create or replace view view_name as select * from table_1,table_2 where join_condition and some conditions.
Now I have added in the view "where" clause two NOT EXISTS conditions based on one another different table respectively.
Before I added these two conditions the response time was fast ; but after I added these two conditions then the response time deteriorated.
So how to optimize the select statement ? Hints and so on ...
Thank you very much indeed
Message was edited by:
andrianiainaJust run the script :
SQL> explain plan for select * from dual;
Explained.
SQL> @$ORACLE_HOME/rdbms/admin/utlxpls.sql
PLAN_TABLE_OUTPUT
| Id | Operation | Name | Rows | Bytes | Cost |
| 0 | SELECT STATEMENT | | | | |
| 1 | TABLE ACCESS FULL | DUAL | | | |
Note: rule based optimization
9 rows selected.
SQL>Nicolas. -
Query transform with where condition not equal to
All,
I have a two tables in a Data services job where I am using a Query transform to load the data from these two tables into another table. In the where tab in query transform i had a conditon saying table1.column1 <> table2.column1 and table1.column2 <> table2.column2.
I need to see the record count of table1-table2 in my final thrid table, but I see more record count and also the not equal condition is failing. Its working for an equal condition but the not equal condition is failing.
The equivalent SQL query for the above transform has to be:
select * from table1 inner join table2 on table1.column1 = table2.column1 where table1.column1 <> table2.column1 and
table1.column2 <> table2.column2.
Any thoughs on how to fix my query transform.
ThanksHi
As per your below statement
"I need to see the record count of table1-table2 in my final thrid table, but I see more record count and also the not equal condition is failing. Its working for an equal condition but the not equal condition is failing."
If you trying to get the records from table-1 which are not in table-2 (as you trying table1-table2)
you can try logic in query transformation where clause
not table1.field1 in (table2.field1)
and
not table1.field2 in (table2.field2)
it gives you count from table1 only
Regards
Ahalya Gopinath -
How to create list partition Where value not equal
Hi ,
How to crate partition where i want to store all data what is not equal to ,priview values,(A,B,C,D,E) ?
PARTITION PN001 VALUES (*is all values !=A,B,C,D,E*) TABLESPACE test_1Thanks !
ID>
In partition
<partition_name> values (default) ? will be stored data where value is null too ?
>
See the VLDB partitioning guide
http://docs.oracle.com/cd/E18283_01/server.112/e16541/part_admin001.htm#sthref247
>
Creating List-Partitioned Tables
The semantics for creating list partitions are very similar to those for creating range partitions. However, to create list partitions, you specify a PARTITION BY LIST clause in the CREATE TABLE statement, and the PARTITION clauses specify lists of literal values, which are the discrete values of the partitioning columns that qualify rows to be included in the partition. For list partitioning, the partitioning key can only be a single column name from the table.
Available only with list partitioning, you can use the keyword DEFAULT to describe the value list for a partition. This identifies a partition that accommodates rows that do not map into any of the other partitions.
>
Note the last two sentences above. The DEFAULT partition will contain data for values (including NULL) that do not map to other partitions. -
Select Statement -- Where Clause Execution Order
What is the order of execution of the "AND" and "OR" in the WHERE clause of a Select statement?
Are the "AND"'s executed from the top down, left to right? Is it the same for the "OR"'s execution?
Thanks for any help...Not clear why you care. There is an order in which the optimizer parses the SQL (which may change from ver to ver), but this is a fairly quick operation. The order in which tables are visited and predicates evaluated is dependent on what the op[timizer does with the SQL.
Ken -
Where data not equal to something
Guys how to retrieve record where emp_name is not equal to 'GEORGE_BUSH';
I mean
select emp_name from emp where emp_name != 'george';
ignores emp_name = null too.
what is the correct syntax.
thanks
msWhen you compare anything to NULL, the result is false. You need to explicitly account for NULL values, i.e.
SELECT emp_name
FROM emp
WHERE emp_name != 'george'
OR emp_name IS NULLJustin -
Mysql select statement where = works and LIKE fails
I am using Flash Builder 4. On the server side I use php and mysql. I created a php dataservice using FB4. My plan had been to allow users to enter a search term and query the database using a "LIKE" statement. FB4 created the php code that I simply modified changing the parameter name. The input parameter is a string.
public function getT_caseByID($searchTerm) {
$stmt = mysqli_prepare($this->connection, "SELECT * FROM $this->tablename WHERE (title = ?)");
$this->throwExceptionOnError();
mysqli_stmt_bind_param($stmt, 'i', $searchTerm);
$this->throwExceptionOnError();
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
mysqli_stmt_bind_result($stmt, $row->idt_case, $row->title, $row->id_author, $row->comments);
if(mysqli_stmt_fetch($stmt)) {
return $row;
} else {
return null;
A look at FB4 shows this code returns data.
This code works fine but if I make the below change it fails, even when I use the wildcard %. the only change is "=" to "LIKE".
public function getT_caseByID($searchTerm) {
$stmt = mysqli_prepare($this->connection, "SELECT * FROM $this->tablename WHERE (title LIKE ?)");
$this->throwExceptionOnError();
mysqli_stmt_bind_param($stmt, 'i', $searchTerm);
$this->throwExceptionOnError();
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
mysqli_stmt_bind_result($stmt, $row->idt_case, $row->title, $row->id_author, $row->comments);
if(mysqli_stmt_fetch($stmt)) {
return $row;
} else {
return null;
A look into FB4 shows "void".
Any help would be appreciated. I am using localhost on Apache Server on a development computer with Windows XP.correctio0n on the select statement
select statement code*********
select
apspnr astspr aobjnr apspid
bpsphi bposid
caufnr cpspel
dinact dstat
eudate eusnam eutime "estat
F~TXT04
g~estat
G~TXT04
into corresponding fields of table itobj
from proj as a
inner join prps as b on apspnr = bpsphi
inner join aufk as c on bpspnr = cpspel
inner join jest as d on cobjnr = dobjnr
inner join jcds as e on dobjnr = eobjnr
and dstat = estat
inner join tj02t as f on estat = fistat
inner join tj30t as g on astspr = gstsma
for all entries in itparm
where apspid = itparm-pspid "or estat = itparm-psy )
or bposid = itparm-posid "or estat = itparm-wsy )
or caufnr = itparm-aufnr "or estat = itparm-nsy )
and ( dinact 'X' or einact 'X')
and fspras = 'E' and gspras = 'E'. -
Select statements where we have to write in crm 7.0
hi
i am new to sap crm 7.0
1)where we are useing select statments in sap crm 7.0
where we have to write the code as a crm technical consultant
at which level genil or bol .if we write can u plz let me knw with clear answer.Subhani,
Writing queries in CRM is always tricky. The question you have asked is very general, still i will try my hands on it for the larger benefit of the community.
One should avoid writing queries on UI layer - As a general practice writing queries on UI is not appreciated because it hampers performance to a large extent.
Use of standard FM instead of queries - There are several standard FM provided by SAP which serves most of the purpose for which queries may have to be written, they are written in a way so as to optimize the DB connect.
BOL/GenIL - Incase the interaction with the DB table is very frequent, Query must be written in BOL/GenIL layer, this is done in order to have a steady framework and avoid frequent DB connect.
If you have any specific query, feel free to post it but be more elaborative so that community members can help.
Regards,
Harshit Kumar -
My send and receive list only gives me the option to send and receive from my email and my phone number is greyed out and it won't let's select it. I am currently in a foreign country but it was working a couple days ago here. What do I do?
Do you have another device with that email/Apple ID on it with iMessage activated? If not, you should be able to remove the checkmark for the email address. You cannot remove the Apple ID email address, but you can turn it off by tapping on it and that should remove the checkmark. Once that is gone, you are good to go. It will only use the phone number.
-
Offset operation in select statements where clause
dear experts,
if i use offset operation in select query , syntactically giving
me a warning message.
how to avoid warning message
without using another internal table populated with only jtab+0(10).
ex:
select field1 field2
into table itab
from ztable1
for all entries in jtab
where field = jtab+0(10).
thanks in advance.No need to populate another internal table...
when populating jtab from database select ur field twice
structure for jtab..
types: begin of ty_jtab,
field type ...
field1 type char10,
end of ty_jtab.
populate the field twice..
select ...
field
field
into table jtab
Now u can use the field field1 in the next select
select field1 field2
into table itab
from ztable1
for all entries in jtab
where field = jtab-field1. -
Number of samples read is not equal to number of AI Sample Clock pulses - why?
Dear Community,
I am using several PXI-4472s for acquisition and at the same time I am routing the AI Sample Clock signal to a PXI-6608 counter/timer card so that I can time stamp each sample.
Unfortunately I am finding that I always get more AI Sample Clock pulses than samples, so I don't know which time stamp corresponds to which sample. Why is that?
For acquisition I am using something very much like the following DAQmx Sync and Stream example:
Sync and Stream.vi
After stopping the tasks, I use DAQmx Read vi again to read whatever samples might be left in the buffer, but that request always comes back empty. I can't figure out if there are AI Sample Clock pulses at the beginning of the task that don't actually acquire any data, or if I have data left over in the buffer after I stop the task that I am not reading properly.
Any help would be greatly appreciated!
CasCas,
DSA boards (like the 4472) differ from standard DAQ devices. While most DAQ devices use a relatively common type of ADC known as a sequential approximation ADC, a DSA device uses a more specialized ADC known as a Delta-Sigma ADC for its measurements. Delta-Sigma ADCs allow for very precise measurements, and this precision is accomplished by oversampling (frequently 128x or 256x the sampling rate that is being used).
The above is a very brief explanation of the DSA board's inner workings. It is discussed in more detail in the document linked below. If after reading that tutorial, you still have questions, please post back so that this forum can assist you.
Synchronization with Dynamic Signal Acquistion (DSA) Products with DAQmx
Best of luck with your application.
Regards,
Jed R.
Applications Engineer
National Instruments -
Select employee where employee not in (select employee where con1=val1)
Hi Gurus,
I have a query which returns a list of employees who particpated in a particular plan(PLAN1). Now I need the list of all other employees who are not in the above list.
1. Restriction: Plan <> 'PLAN1' does not work out for my requirement
2. I created a variable (VAR1) with replacement path by Query. But I cannot use this variable for Exclusion.
3. I created a customer exit variable with the idea of copying the values from (VAR1) and change the Sign to "Exclude". But the variable VAR1 (being a replacement path by query) is not being populated in list of variables i_t_var_range in the variable exit.
What are the other options that I can try out ? Please let me know.
Points for all the helpful answers are assured.
Thanks,
Giri.Sorry for the delay. If I understand you correctly
E1 P1
E1 P2
E2 P1
E2 P2
E3 P2 ; your task is to fetch E3
In your first query you have already identified E1&E2 as having P1. E3 does not have P1. Thus use the 1st query as the replacement path for the 2nd query. Except you use <u>only</u> the employee characterstic <u>not</u> the plan characterstic, as the replacement variable. This should fetch you E3 -
Using column number inplace of column name in SQL Select statement
Is there a way to run sql select statements with column numbers in
place of column names?
Current SQL
select AddressId,Name,City from AddressIs this possible
select 1,2,5 from AddressThanks in Advanceuser10962462 wrote:
well, ok, it's not possible with SQL, but how about PL/SQL?As mentioned, using DBMS_SQL you can only really use positional notation... and you can also use those positions to get the other information such as what the column is called, what it's datatype is etc.
CREATE OR REPLACE PROCEDURE run_query(p_sql IN VARCHAR2) IS
v_v_val VARCHAR2(4000);
v_n_val NUMBER;
v_d_val DATE;
v_ret NUMBER;
c NUMBER;
d NUMBER;
col_cnt INTEGER;
f BOOLEAN;
rec_tab DBMS_SQL.DESC_TAB;
col_num NUMBER;
v_rowcount NUMBER := 0;
BEGIN
-- create a cursor
c := DBMS_SQL.OPEN_CURSOR;
-- parse the SQL statement into the cursor
DBMS_SQL.PARSE(c, p_sql, DBMS_SQL.NATIVE);
-- execute the cursor
d := DBMS_SQL.EXECUTE(c);
-- Describe the columns returned by the SQL statement
DBMS_SQL.DESCRIBE_COLUMNS(c, col_cnt, rec_tab);
-- Bind local return variables to the various columns based on their types
FOR j in 1..col_cnt
LOOP
CASE rec_tab(j).col_type
WHEN 1 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000); -- Varchar2
WHEN 2 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_n_val); -- Number
WHEN 12 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_d_val); -- Date
ELSE
DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000); -- Any other type return as varchar2
END CASE;
END LOOP;
-- Display what columns are being returned...
DBMS_OUTPUT.PUT_LINE('-- Columns --');
FOR j in 1..col_cnt
LOOP
DBMS_OUTPUT.PUT_LINE(rec_tab(j).col_name||' - '||case rec_tab(j).col_type when 1 then 'VARCHAR2'
when 2 then 'NUMBER'
when 12 then 'DATE'
else 'Other' end);
END LOOP;
DBMS_OUTPUT.PUT_LINE('-------------');
-- This part outputs the DATA
LOOP
-- Fetch a row of data through the cursor
v_ret := DBMS_SQL.FETCH_ROWS(c);
-- Exit when no more rows
EXIT WHEN v_ret = 0;
v_rowcount := v_rowcount + 1;
DBMS_OUTPUT.PUT_LINE('Row: '||v_rowcount);
DBMS_OUTPUT.PUT_LINE('--------------');
-- Fetch the value of each column from the row
FOR j in 1..col_cnt
LOOP
-- Fetch each column into the correct data type based on the description of the column
CASE rec_tab(j).col_type
WHEN 1 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_v_val);
DBMS_OUTPUT.PUT_LINE(rec_tab(j).col_name||' : '||v_v_val);
WHEN 2 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_n_val);
DBMS_OUTPUT.PUT_LINE(rec_tab(j).col_name||' : '||v_n_val);
WHEN 12 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_d_val);
DBMS_OUTPUT.PUT_LINE(rec_tab(j).col_name||' : '||to_char(v_d_val,'DD/MM/YYYY HH24:MI:SS'));
ELSE
DBMS_SQL.COLUMN_VALUE(c,j,v_v_val);
DBMS_OUTPUT.PUT_LINE(rec_tab(j).col_name||' : '||v_v_val);
END CASE;
END LOOP;
DBMS_OUTPUT.PUT_LINE('--------------');
END LOOP;
-- Close the cursor now we have finished with it
DBMS_SQL.CLOSE_CURSOR(c);
END;
SQL> exec run_query('select empno, ename, deptno, sal from emp where deptno = 10');
-- Columns --
EMPNO - NUMBER
ENAME - VARCHAR2
DEPTNO - NUMBER
SAL - NUMBER
Row: 1
EMPNO : 7782
ENAME : CLARK
DEPTNO : 10
SAL : 2450
Row: 2
EMPNO : 7839
ENAME : KING
DEPTNO : 10
SAL : 5000
Row: 3
EMPNO : 7934
ENAME : MILLER
DEPTNO : 10
SAL : 1300
PL/SQL procedure successfully completed.
SQL> exec run_query('select * from emp where deptno = 10');
-- Columns --
EMPNO - NUMBER
ENAME - VARCHAR2
JOB - VARCHAR2
MGR - NUMBER
HIREDATE - DATE
SAL - NUMBER
COMM - NUMBER
DEPTNO - NUMBER
Row: 1
EMPNO : 7782
ENAME : CLARK
JOB : MANAGER
MGR : 7839
HIREDATE : 09/06/1981 00:00:00
SAL : 2450
COMM :
DEPTNO : 10
Row: 2
EMPNO : 7839
ENAME : KING
JOB : PRESIDENT
MGR :
HIREDATE : 17/11/1981 00:00:00
SAL : 5000
COMM :
DEPTNO : 10
Row: 3
EMPNO : 7934
ENAME : MILLER
JOB : CLERK
MGR : 7782
HIREDATE : 23/01/1982 00:00:00
SAL : 1300
COMM :
DEPTNO : 10
PL/SQL procedure successfully completed.
SQL> exec run_query('select * from dept where deptno = 10');
-- Columns --
DEPTNO - NUMBER
DNAME - VARCHAR2
LOC - VARCHAR2
Row: 1
DEPTNO : 10
DNAME : ACCOUNTING
LOC : NEW YORK
PL/SQL procedure successfully completed.
SQL>
Maybe you are looking for
-
I would like to connect my Apple TV 3rd gen to a projector and not an HD TV (so I can watch movies on the big screen). Are there any decent price compatible projectors? Good quality but not professional! Many thanks
-
Is it possible to use NAS storage (WD My Cloud EX2 or WD My Cloud EX4) which is wired via LAN to current AirPort Extreme, as a Time Machine backup destination? There are two reasons I came up with this question. - Connecting via Ethernet should be fa
-
My macbook pro started turn off slow after doing the dirk repair
It takes like a minute to turn off. it used to take a second to turn off and I loved it but now it takes a lot longer.all I did was do the "disk repair" and verify the disk. Thanks.
-
My iPad keeps on saying that its connected to a dock and sound mutes, what can I do?
This keeps happening and I have no idea what to do, do I send it back ? Any help will be appreciated thanks
-
Identifying idoc in SAP system using message id in XI system
Hello Experts, I have executed a couple of XML's that wil be read by XI and passed into my crm system. In XI using the transaction SXMB_MONI i am able to see the executed XML files . Is there any way i can track the exact idoc no for a par