Is there a mysql equivalent of pg_query_params?
Check mysqli_prepare() or PDOStatement(). Both are a bit different, but still use a prepared statement.
Related
I see JOOQ doesn't support MySQL's IF Function, But I find iif() in DSL.java, it's SQL Sever style, I used it in MySQL, it works well, so can I use iff() in My MySQL query?
It's my test code
dslContext.select(EMPLOYEE.EMPLOYEE_ID,
DSL.iif(EMPLOYEE.ALGO.eq(1), EMPLOYEE.FULLNAME, EMPLOYEE.ACCOUNT).as("fullname"))
.from(EMPLOYEE)
.where(EMPLOYEE.EMPLOYEE_ID.eq(100)).fetchOneInto(Employee.class);
jOOQ 3.14 will add native support for MySQL's IF() via #10160. This isn't really a necessary feature, it's mere convenience compared to writing the equivalent CASE expression:
-- MySQL
IF (C, A, B)
-- Standard SQL
CASE WHEN C THEN A ELSE B END
If you prefer IF(), you can always write your own plain SQL template even before jOOQ 3.14
suggest an alternative query for this type of condition in sql
select v_sdi_previous_id,v_sdi_settlement_flag,v_sdi_studentid
from schooldev."STUDENT_DETAILS_INFO"
where (upper(v_sdi_studentid)=upper('BS15B016') or (upper(v_sdi_previous_id)=('BS15B016')) )
and n_sdi_schoolid='1' and v_sdi_active_flag='Y'
It is pretty simple query. What alternative you want ?
You may use IN instead of multiple OR like-
where upper(v_sdi_studentid) IN ('BS15B016', 'BS15B016')
and n_sdi_schoolid='1' and v_sdi_active_flag='Y'.
Nothing much is needed with this query unless you are not getting the output as per your need.
select v_sdi_studentid as new_id,v_sdi_previous_id,v_sdi_settlement_flag from schooldev."STUDENT_DETAILS_INFO" where upper(v_sdi_previous_id) IN ('BS15B016') and n_sdi_schoolid='1' and v_sdi_active_flag='Y'
Is there any equivalent for the Oracle DBMS function DBMS_LOB.SUBSTRING on Mysql?
if not how can I get the text of BLOB in MYSQL server? (I only need to use SQL no other programming languages)
Please try dbms_lob.substr which is equivalent to DBMS_LOB.SUBSTRING
Get the Oracle value passed to dbms_lob.substr and prefix the value with 0x without quotes for the MySQL insert statement.
I did tried for my case and succeeded.
can any one help me to use the mysql inbuilt function in cakePHP?????
If you don't want to use
$this->Model->query($yoursql);
Then there's still another way for some mysql functions such as concat,date_format
$this->Model->find($findtype,array('fields'=>array('concat (column1,column2,...) as con','date_format(...) as mydate'),'conditions'=>...));
There is an example of how to use CONCAT in the book. I imagine you would be able to extend the syntax to use the other MySql functions as required.
I couldn't find anything about this in MySQL documentation.
SELECT accesion_id,
definition
FROM accesion_table
WHERE search_word ## ? OFFSET ? LIMIT Const.MAX_DISP_COUNT;
Most likely the code that is executing this sql statement has some parser that's handling this odd syntax, since the the ##, ? and Const.MAX_DISPLAY_COUNT aren't part of MySQL. Also the keyword OFFSET must be placed after the LIMIT keyword.
With Oracle the '##' to point to the current directory of the executing file. Could it be that MySql might be following Oracles lead?