SQL Statement - Reading Input Field
I have a simple SQL statement which takes an input value and searches for it in the database. I am wondering what is the syntax in Visual Composer to pass the input value using a form to the SQL statement. In other words how can I read the value of the search field of the input form in the SQL Query.
Example: select * from Table WHERE Description LIKE <b><Search Term></b>
I would like to know the syntax to read the Search term from the input form.
Any help will be greatly appreciated.
In the current version of VC input fields are available only for dataservices based on relational templates in BI Query Wizard(Not created in the SQL editor).
You can select "All data" template for a single table or "Freeform" if you would like to do something more complex and provide a filter via input field.
Best regards,
Natalia
Similar Messages
-
What is wrong in SQL Statement with CLOBs Fields
Hello, need help!! I create that SQL:
select
id, caid, region_id, folder_id, masterthingid, visible, display_name, image, keywords, publish_date, subtype, text,
max(decode(name, 'Destaque', value, null)) destaque,
max(decode(name, 'Fonte', value, null)) fonte,
max(decode(name, 'Legenda', value, null)) legenda,
max(decode(name, 'chamada', value, null)) chamada,
max(decode(name, 'TitulodaChamada', value, null)) titulo_chamada,
max(decode(name, 'Tema', value, null)) tema
from portal.lista_noticias_total
group by id, caid, region_id, folder_id, masterthingid, visible, display_name, image, keywords, publish_date, subtype
But the field 'text' doesn't appear =|~
Im doing anything wrong?
Help-me!!
Thks for attencionHi,
You can't GROUP BY a CLOB.
Sorry, I missed that part of your subject line.
My original answer follows:
I don't see a ; anywhere. Is that the complete query?
If so, you need to add text to the GROUP BY clause:
group by id, caid, region_id, folder_id, masterthingid, visible, display_name, image, keywords, publish_date, subtype
, textEdited by: Frank Kulash on Mar 4, 2009 3:04 PM -
How to set Query SQL Statement parameter dynamically in Sender JDBCAdpter
Hi All,
I have one scenario in which we are using JDBC Sender Adapter.
Now in this case,we need to set Query SQL Statement with a SELECT statement based on some fields.
This SQL statement is not constant, it would need to be changed.
Means sometimes receiver will want to execute SQL statement with these fields and sometimes they will want to execute it with different fields.
We can create separate channels for each SQL statement but again that is not an optimum solution.
So ,I am looking out for a way to set these parameters dynamically or set SQL statement at Runtime.
Can you all please help me to get this?Shweta ,
<i>Sometimes receiver will want to execute SQL statement dynamically</i>....
How you will get the query dynamically? Ok Let me assume, consider they are sending the query through file, then its definitely possible. But u need BPM and also not sender JDBC receiver adapter instead, receiver JDBC adapter.
SQL Query File ->BPM>Synchronous send [Fetch data from DB]--->Response -
>...............
Do u think the above design will suit's ur case!!!!
Best regards,
raj. -
Statements in calculation fields
Can you use sql statements in calculated fields, for instance can you use a statement like IF(GL_SEGMENT-04='401000'TO'409999'THEN SUM(GL_BALANCE_PERIOD_BAL_DB-GL_BALANCE_PERIOD_BAL_CR)
I would think that you could use statements within calculated fields but I am having no luck.
Thanks in advanceYou are so close, I guess. An alternative syntax you may try:
SUM(CASE WHEN SEGMENT3 BETWEEN '401010' AND '405999' THEN PERIOD_NET_DR-PERIOD_NET_CR ELSE 0 END)
You may get error message for not using table prefix. In that case, use the table prefix with each field. As you have seen, Discoverer takes care of the prefix when it first executes the formula. Regarding 0 balance, make sure that the sum is not zero for that range. You may also try with a bigger range. Good luck! -
HI guys:
I need code three SQL statements.the returned field and selected table are all same,there is only a difference in their "where" statement.
Sample code:
select marcmatnr marcwerks
into table it_data
from MARC inner join MBEW on marcmatnr = mbewmatnr
where marcmatnr like 'A%' and mbewzplp1 = '001'.
second one........................ mbew~zplp2 = '001'
third one......................... mbew~zplp3 = '001'
Could I write a FORM gather them with transporting a parameter ZPLPX to determine which condiniton will be execute?
thank you very much.Hi tianli,
1. source text
This concept of dynamic where
condition is called source text.
2. use like this.
This is important in the code ---> WHERE (mywhere).
REPORT abc LINE-SIZE 80.
DATA : it_data LIKE TABLE OF mara WITH HEADER LINE.
QUOTES ARE IMPORTANT
PERFORM mysql USING 'mbew~zplp2 = ''001'''.
FORM mysql USING mywhere.
SELECT marcmatnr marcwerks
INTO TABLE it_data
FROM marc INNER JOIN mbew ON marcmatnr = mbewmatnr
WHERE (mywhere).
ENDFORM. "mysql
regards,
amit m. -
Hi currently i have a problem with the sql statement.
The field name and the table name of the sql statement will depend on what the user input. We need to find out what records is in tableA columnA and not in tableB columnB.
Below is my sql statement:
SELECT * FROM (TABLEA) INTO TABLE ITABA
WHERE (COLUMNA)
NOT IN ( SELECT (COLUMNB) FROM (TABLEB) ).
=============================================
ColumnA = "the user input the field name"
TableA = " the user input the table name"
TableB = " the user input the table name"
The problem lies at the WHERE clause. The system generate a sql error which says "unable to find the field name".Hi,
Check the following code:
For dynamic table name....
REPORT demo_select_dynamic_database .
DATA wa TYPE scarr.
DATA name(10) TYPE c VALUE 'SCARR'.
SELECT *
INTO wa
FROM (name) CLIENT SPECIFIED
WHERE mandt = '000'.
WRITE: / wa-carrid, wa-carrname.
ENDSELECT.
For dynamic field list
REPORT demo_select_dynamic_columns .
DATA: itab TYPE STANDARD TABLE OF spfli,
wa LIKE LINE OF itab.
DATA: line(72) TYPE c,
list LIKE TABLE OF line(72).
line = ' CITYFROM CITYTO '.
APPEND line TO list.
SELECT DISTINCT (list)
INTO CORRESPONDING FIELDS OF TABLE itab
FROM spfli.
IF sy-subrc EQ 0.
LOOP AT itab INTO wa.
WRITE: / wa-cityfrom, wa-cityto.
ENDLOOP.
ENDIF.
Regards,
Bhaskar -
Query SQL Statement & Update SQL Statement
Hi!
I configure the JDBC adapter sender (XI) to take data from MSSQL database.
I have to run select like this:
SELECT
tblMilestone.Site,
tblMilestone.Revision,
tblMilestone.MilestoneNameID,
tblMilestone.ApprovedDate,
tblMilestoneName.MilestoneName
FROM
tblMilestoneName
INNER JOIN tblMilestone ON tblMilestoneName.MilestoneNameID = tblMilestone.MilestoneNameID
WHERE tblMilestone.StatusCode = 1;
My question is what "Update SQL Statement" I should use in communication channel definition? I only need to update tblMilestone or this two tables?
Maybe you give me some example.Check this from SAP help...
Update SQL Statement
You have the following options:
● Enter a valid SQL statement that is to be applied to the database once the data (determined from the Query SQL Statement) has been successfully sent to the Integration Server/PCK.
It must be an INSERT, UPDATE, or DELETE statement.
● In place of the SQL statement, you can also enter <TEST>. Once the data determined from Query SQL Statement has been successfully sent, the data in the database remains unaltered.
This is recommended if the data has not only been read, but also changed by a stored procedure entered under Query SQL Statement. -
ALDSP 3.0 -- schema owner for stored procedure or SQL Statement
Using ALDSP, I have a need to create a physical service based on a stored procedure or a SQL statement. I am wondering what will happen when I move to another deployment environment where the schema owner changes. In our QA and Prod environments, we have a different schema owner for all tables in the application (the DBAs believe this prevents unwanted updates to a prod environment). DSP elegantly supports this for normal table- and view-based physical services by mapping schemas through the DSP console after deployment. Will I get the same type of mapping capability for stored procedures and SQL statements? I noticed that I can add a SQL-based function to a physical service...is there a way to pass in the physical table name from that data service to the procedure or SQL statement?
Thanks,
JeffSchema name substitution should work for stored procedures just like it does for tables. If it doesn't - report a bug.
You don't get any help for sql-statement based data services - dsp doesn't parse the sql provided. One thing you could do is use the default schema (following the user of your connection pool), and not specify the schema in your sql-statement. -
Can you really update two tables in one SQL statement
Ok a post in the forum has got me awefully curious:
Can you update two tables in one update statement i.e something like this
update table a , b
set b.<column> = something
a.<column> = something
Something to this effect.
If you are curious to know what post I am talking about it is called "updating a single row"No. You can only update one table in one SQL statement.
-
Excuting multiple sql statements
Hi to everybody.
I'm quite new to Oracle even if i have quite a big experience with MySQL and SQL commands. I'm facing a problem that I suppose it is a really basic one.
I received a dump of an Oracle database in a .sql format. I mean that both the schema and the data are build through a large number of sql statements. In particular the schema is made through a lot of "create table ..." while the data are built through "insert into..". My need is to import these database in a fresh Oracle database Oracle 10 g XE.
I've installed it on a Debian system and i can succesfully execute a single SQL command both through the web interface http://localhost:8080/apex and logging as oracle user through the sqlplus username/passwd command.
My problem is that the data are split on about 12000 SQL "INSERT INTO.." so executing all of them one by one could be a little annoying :-)
<u>So I'm asking if there is a way to instruct Oracle to execute multiple SQL statements reading it from a file (like MySQL does for example).</u>
I' m considering to write a script to do it if there's no better way. I know that there're better way to dump databases in Oracle but I can change the .sql format since it is the only one that I got.in SQL*Plus you can execute a SQL file with the start command or it's shorthand version @:SQL> start filename.sql
or
SQL> @filename.sql -
SQL statement inside a SQL statement
Hello,
I'm trying to write a SQL statement to a field in a table ( so that i can store some sql statements in a table) For the most part this code works fine (where string1 is the statement):
updatestring1 = "update [@SQLSTATEMENTS] set [U_statement] = '" & qstring1.ToString & "' where [Code] = " & row
oRecordSet.DoQuery(updatestring1)
but when the statement that i want to save contains a WHERE clause that refernces a string (enclosed by single quotes), the update query fails - because of the quotes i think.
I'm thinking i might be able to use different symbols in the statement to signify that it is a string but i'm not sure...
Is there a better way to write the query to a field in a table ? maybe one that doesn't require an update query ? I'm pretty new to SDK (and SQL), so any advice will help - even if it's something really obvious...
Thanks!I am not sure why you need to save SQL queries in the table but, you need to follow up a single quote with another single quote. for example look at the following sql string
update customer set custname = 'Customer'' A' where custid = 'CustA'
'IS correct
However the following will fail
update customer set custname = 'Customer' A' where custid = 'CustA'
Message was edited by: Indika Dekumpitiya -
Building up dymanic SQL statement from user entered fields on a jsp
Hi guys.
I'm building up a sql statement from a bunch of input fields that the users can type in on a .jsp page. No real problem there, but I get a problem when they type in words with ' character in it Eg: Don't, I'll etc.
This confuses the java code totally and usually results in a spectacular crash of the system.
Any ideas/thought/wild speculations would be most appreciated.
Regards
Elmar Matthee
University of Stellenbosch
South AfricaEven in pure read-only databases SQL injection can be a problem, as the user might be able to read data he should not be able to see.
You can also create dynamically created sql statements using PreparedStatements, that's not a problem, I'm doing it pretty often myself.
List<Object> arguments = new ArrayList<Object>();
StringBuilder sql = new StringBuilder("SELECT foo FROM bar WHERE");
if (someCondition) {
sql.append(" foobar = ? ");
arguments.add(someValue);
if (someOtherCondition) {
sql.append(" AND barfoo = ?");
arguments.add(someOtherValue);
// later on use setObject() to fill in the parametersObviously you'll have to handle putting the correct ANDs and ORs there, but you probably has solved that already, as it isn't any different if you don't use a PreparedStatement. -
How do I use SQL statements to perform calculations with form fields????
Please help!!! I don't know how to use a SQL statement within my APEX form......
My form is below. The user will enter the values in the form. Click on Submit. Then we need to run a SQL select statement with those values.
Our form looks like this:
Start_Date ____________
Per_Period ____________
Period ____________
[Submit Button]
The user will enter these 3 values in the form.
This is an example of an user providing the values:
Start_Date 03/14/08_______
Per_Period $200.00________
Period 4____________
[Submit Button]
Then they will click the Submit Button.
The SQL statement (BELOW) returns output based on the users selections:
START_DATE PER_PERIOD PERIOD
14-MAR-2008 00:00 200 Week 1 of 4
21-MAR-2008 00:00 200 Week 2 of 4
28-MAR-2008 00:00 200 Week 3 of 4
04-APR-2008 00:00 200 Week 4 of 4
Total 800
This is the full text of the SQL that makes the output above:
with criteria as (select to_date('03/14/08', 'mm/dd/rr') as start_date,
4 as periods,
'Week' as period,
200 per_period from dual),
periods as (select 'Week' period, 7 days, 0 months from dual
union all select 'BiWeek', 14, 0 from dual
union all select 'Month', 0, 1 from dual
union all select 'ByMonth', 0, 2 from dual
union all select 'Quarter', 0, 3 from dual
union all select 'Year', 0 , 12 from dual
t1 as (
select add_months(start_date,months*(level-1))+days*(level-1) start_date,
per_period,
c.period||' '||level||' of '||c.periods period
from criteria c join periods p on c.period = p.period
connect by level <= periods)
select case grouping(start_date)
when 1 then 'Total'
else to_char(start_date)
end start_date,
sum(per_period) per_period,
period
from t1
group by rollup ((start_date, period))
THANKS VERY MUCH!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!You're just doing a parameterized report, where the input fields are your parameters.
Check out the Advanced Tutorial titled Parameterized Report here:
http://download.oracle.com/docs/cd/E10513_01/doc/appdev.310/e10497/rprt_query.htm#BGBEEBJA
Good luck,
Stew -
Adding a field to an sql statement in Oracle Reports error ORA-00933
We have been requested to add a field that already exists in the table referred to by the sql statement in Oracle Reports Builder. The report was set up by a consultant about 3 yrs ago and we don't really have much skill in this area. What is happening when I try to modify the SQL statement, either adding a field or deleting a field to the SELECT statement, causes an error message preventing the statement from being saved. The only way out of the error message is to click Cancel. The error message is
ORA-00933:SQL command not properly ended
ORDER BY Program ==> NAME
Even adding or deleting a space anywhere in the SQL statement causes the error (not adding any new fields). A coworker found that if we comment out the ORDER BY, the statement will accept the new field in the SELECT section, however then we lose the order by functionality. I would like to add one additional field before the FROM. Not sure if any additional data are needed. Thank you.
SELECT p.person_uid PIDM_KEY, p.id_number ID,
p.full_name_lfmi name,
p.BIRTH_DATE, p.GENDER Sex,
Decode(a.residency,'D',p.Primary_ethnicity,'F') Ethn,
a.academic_period TERM,
CASE WHEN :p_group_by = 'PROGRAM' THEN a.program
ELSE ' '
END AS Program,
a.COLLEGE, a.degree, a.major, ' ' rule,
a.STUDENT_POPULATION,a.STUDENT_LEVEL, a.application_status Status, a.application_status_date app_sts_dte,
ad.decision_date1 Last_Dec_Date,
ad.decision1||' '||ad.decision2||' '|| ad.decision3||' '|| ad.decision4||' '|| ad.decision5 Decisions,
/* Deposit Date uses the last term entered in :p_term parameter string */
(SELECT MAX(deposit_effective_date) FROM usf_as_deposit WHERE account_uid = a.person_uid &term_clause group by account_uid) AS "DEPOSIT DATE",
ph.phone as PHONE,
CASE WHEN PS.FIRST_CONTACT IN ('NET','PAP','COM','COP') THEN PS.First_Contact
ELSE CASE WHEN ps.latest_contact IN ('NET','PAP','COM','COP') THEN PS.Latest_Contact
ELSE ' '
END
END AS FIRST_CONTACT,
DECODE(:p_address,'Y',REPLACE(adr.street1||' '||adr.street2||' '||adr.street3||' '||adr.city||','||adr.state||' '||adr.nation||' '||adr.zip,' ',' '),' ') as address, adr.nation, adr.state,
goremal_email_address email, a.residency, a.application_date, p.primary_ethnicity, c.cohort
FROM MST_ADMISSIONS_APPLICATION A,
MST_PERSON p,mst_pre_student PS, Admissions_Cohort c, usf_v_phone_pr_ma ph,
MST_admissions_decision_slot AD, usf_v_email, usf_v_address_dr_lr_ma_pr adr
WHERE a.PERSON_UID = p.person_uid
AND a.curriculum_priority = 1
AND a.person_uid = ps.person_uid
AND a.person_uid = ad.person_Uid(+)
AND a.person_uid = goremal_pidm(+)
AND a.person_uid = adr.pidm(+)
AND a.person_uid = ph.pidm(+)
AND ph.rnum(+) = 1
AND a.person_uid = c.person_uid(+)
AND a.academic_period = c.academic_period(+)
&Where_Clause
/* TAKE OUT FOLLOWING LINE AFTER DATA IS CLEANED UP */
AND NOT(p.id_number = '00000000' OR SUBSTR(p.id_number,1,1) = 'B' OR UPPER(p.full_name_lfmi) LIKE '%TESTING%')
AND a.application_status_date >= NVL(:p_as_of_date,sysdate-8000)
AND a.academic_period = ad.academic_period(+)
AND a.application_number = ad.application_number(+)
AND a.degree <> 'ND' /* AND a.college <> 'LW' -- Does not need non-degree and law students */
&Cohort_Clause
ORDER BY Program &ORDER_CLAUSEHi Denis,
I tried your suggestion. The good thing is that adding the comma allowed me to be able to add a.campus to the select statement, unfortunately, another error message happened.
ORA-00936: missing expression SELECT p . person_uid PIDM_KEY ,
p . id_number , p . full_name_lfmi name , p . BIRTH_DATE , p . GENDER Sex ,
Decode ( a . residency , 'D' , p . Primary_Ethnicity , 'F' ) Ethn , a . academic_period TERM ,
CASE WHEN : P_group_by = 'PROGRAM THEN a I started over and tried only putting in the comma and get the same message even though I didn't add campus. After that, removed the comma which led to the ORA-00933 error message. So once again, I had to close the file without saving, in order for the report to run at all. -
Update SQL statement in JDBC sender (system fields)
All,
Is it possible to update more than 1 field via the update sql statement ?
Also, is it possible to use system fields ?
Something like this
UPDATE database.table SET processed='Y', date = sy-datum
Regards, MichelHi
use sysdate as suggested above
Check your generated SQL query format is correct
At runtime you can find the genereated sql statements by doing configuraitons in Receiver JDBC adapter.
In the JDBC Receiver adapter you have the Advanced Properties .
Over there enter the following
left column logSQLStatement
right column true
To see the query created ..
Login to adapter monitoring ..select the relevant jdbc adapter.
Now when any message is processed by the jdbc adapter in adapter monitoring at that time you will see a message link. When you click on that link a new window will open. In that window if you click on page down you will get to see the sql statement generated by the jdbc adapter.
Maybe you are looking for
-
I just installed Pages 5.5.2 after working in Pages 4.3 for the last three years... no wonder everyone is giving 5.5 such a bad rap (refer to the number of 1-star-I-hate-it votes on the App Store). My problem is Pages v4.X and Pages v5.X compatibilit
-
Automatic Creation PO from Sales Order
Hi All, I'd like to make automatic PO Creation check box (Sales Order - logistics tab) is checked by default (not blank). Do you have any idea how to do this? Currently I use SAP B1 2005B version. Thanks and Regards
-
Everything seemed fine, but after I added some new files to iTunes, the files were not found in the iTunes. What's going on??? It shows that the songs is being loaded into iTunes, but there's actually no file!!!
-
Problems exporting a pdf from indd book panel
I have an indd book set up and when I try to export the book the file stops halway through. Thought it was getting hung up on some images, so replaced those. Document got hung up at another point after that. If I create the book in 2 sections the pdf
-
Hi , I am using sendRedirect( ) method in jsp . ( redirecting to a servlet to generat an image) . It works on most of the places , I tested. On some machine it's not working tough the browser version is same (IE 5.00) , but it works in Netscape on sa