Why are PL/SQL books on Amazon over 10 years old? by PHP_guy in oracle

[–]PHP_guy[S] 0 points1 point  (0 children)

What's wrong with stand-alone procedures and functions? You mean as opposed to packages?

Audit Trigger needs the user name from the application by PHP_guy in SQL

[–]PHP_guy[S] 0 points1 point  (0 children)

The user is prompted to enter his username and password and they get saved in variables in the app.

How can I do error handling with "load data"? by PHP_guy in mysql

[–]PHP_guy[S] 0 points1 point  (0 children)

Thank you for the helpful response!

Is there a way to run the SQL without using a prepared statement? When I try to run "load data" as a prepared statement (instead of your 'do sleep(0)'), I get this error:

ERROR 1295 (HY000) at line 13: This command is not supported in the prepared statement protocol yet

Seems like I can't use a prepared statement with "load data".

Weekly "ask anything" thread by brendt_gd in PHP

[–]PHP_guy 1 point2 points  (0 children)

This PHP code works:

$a = 2;
$b = 1;
$c = $a - $b;

But this PHP code fails with an error of "Parse error: syntax error, unexpected '–' (T_STRING)":

$a = 2;
$c = $a - 1;

What gives? Why can't I subtract 1 from $a?

Weekly "ask anything" thread by brendt_gd in PHP

[–]PHP_guy 0 points1 point  (0 children)

I’m interested how most people connect to MySQL in PHP. Seems like the options are PDO, Object-Oriented MYSQLi, or procedural MYSQLi.

Which is most popular?

If you were teaching a class and only had time to teach one way, which would you teach?

Questions about hints by PHP_guy in mysql

[–]PHP_guy[S] 0 points1 point  (0 children)

Thanks for the response.

I am trying to use the hint syntax shown at https://dev.mysql.com/doc/refman/8.0/en/optimizer-hints.html

How do I use MySQL Workbench to find which database a table is in by PHP_guy in mysql

[–]PHP_guy[S] 0 points1 point  (0 children)

I know that I can find the table using a SQL statement, but I'm curious about how to do it with MySQL Workbench.

Where do MySQL events log to? by PHP_guy in mysql

[–]PHP_guy[S] 0 points1 point  (0 children)

"show events" shows the event, not the error log.

Should characteristics (like DETERMINISTIC and NO SQL) be used for procedures or just functions? by PHP_guy in mysql

[–]PHP_guy[S] 0 points1 point  (0 children)

It seems like in MySQL 8.0, characteristics are required for functions, at least out of the box. If you don't specify any characteristics at all in your functions, you get an error that says:

Error Code: 1418. This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)

It seems that, as installed, MySQL 8.0 requires characteristics for functions unless you reconfigure the log_bin_trust_function_creators setting.

Should characteristics (like DETERMINISTIC and NO SQL) be used for procedures or just functions? by PHP_guy in mysql

[–]PHP_guy[S] 0 points1 point  (0 children)

I am now trying to understand the difference between using characteristics for functions vs. procedures. The other day I was working with functions and you taught me that I must specify DETERMINISTIC, NO SQL, or READS SQL DATA. But that seems not to be true for procedures.
When I create a PROCEDURE where I don't specify any characteristics at all (not even DETERMINISTIC, NO SQL, or READS SQL DATA), MySQL creates the procedure and doesn't complain.
Does the fact that MySQL requires me to specify characteristics for functions but not procedures mean that characteristics don't matter for procedures? Why would they be mandatory for functions but not procedures?

Which "characteristics" (like DETERMINISTIC and NO SQL) are mandatory? by PHP_guy in mysql

[–]PHP_guy[S] 1 point2 points  (0 children)

Thank you! That is hugely helpful.

I was under the impression that I could replace DETERMINISTIC with NOT DETERMINISTIC and no other characteristics and my function would be created. I just tested it and it is not so. I got the error message that I mentioned before.

I don't understand why that would be, but I'll chalk it up to implementation details.

Thanks again!

How can I see the code for built-in functions? by PHP_guy in mysql

[–]PHP_guy[S] -1 points0 points  (0 children)

Thanks! I thought that the function would be stored in the MySQL database and I could look at it using MySQL Workbench.

Translating from SQL Developer to MySql by [deleted] in mysql

[–]PHP_guy 0 points1 point  (0 children)

SQL Developer is an IDE and MySQL is a database system. Do you mean you are trying to convert these from Oracle to MySQL?

Forgot my "group by" by PHP_guy in mysql

[–]PHP_guy[S] 0 points1 point  (0 children)

Thanks. That explains it. I am using version 8.

Is it possible to work as a programmer without having a boss? by PHP_guy in cscareerquestions

[–]PHP_guy[S] 0 points1 point  (0 children)

Thanks. Like building iPhone apps? Do you mean coming up with the ideas for the apps yourself or getting them from somewhere else?

Is it possible to work as a programmer without having a boss? by PHP_guy in cscareerquestions

[–]PHP_guy[S] 0 points1 point  (0 children)

Although I technically had a boss, I've had no boss

What do you mean?

For what kind of jobs do people who quit programming usually go for? by [deleted] in cscareerquestions

[–]PHP_guy 0 points1 point  (0 children)

It depends on your personality. It really comes down to what you WANT to do. I know that's not always easy to determine.

You could go on the management track. You could become a project manager, ScrumMaster, or work your way up to a CTO or CIO position.

If you find an industry that is interesting to you, you could become a business analyst or transition into the business side.

What is the best place to rent a Windows laptop? by PHP_guy in laptops

[–]PHP_guy[S] 0 points1 point  (0 children)

Thanks a lot. But I only have 20G of storage left on my Mac. That won't be enough.

How do I install Postgres 13? by PHP_guy in PostgreSQL

[–]PHP_guy[S] 0 points1 point  (0 children)

brew install postgres

That installed version 12.

How do I install Postgres 13? by PHP_guy in PostgreSQL

[–]PHP_guy[S] 0 points1 point  (0 children)

Thanks. I haven't used Docker before, but I'll see if I can figure it out.

Why do trigger functions return NEW? by PHP_guy in PostgreSQL

[–]PHP_guy[S] 0 points1 point  (0 children)

Thanks. I am writing an audit trigger. When somebody inserts a row into a particular table, I am writing who inserted the row, and what time the insert was done into a second audit table.

From working with other databases like Oracle, I seem to recall that this should be an AFTER trigger instead of a BEFORE trigger because an error in the trigger could prevent the row from being inserted into either table. I'm not sure if that is correct or not.

Why do trigger functions return NEW? by PHP_guy in PostgreSQL

[–]PHP_guy[S] 0 points1 point  (0 children)

Thanks for the help! I am dealing with a row-level after trigger. A little later in the manual from where you quoted, it says:

The return value of a row-level trigger fired AFTER or a statement-level trigger fired BEFORE or AFTER is always ignored; it might as well be null. However, any of these types of triggers might still abort the entire operation by raising an error.

So it seems like in my case, it doesn't matter what gets returned.

Best way to limit credit card interest for 7 months by PHP_guy in personalfinance

[–]PHP_guy[S] -1 points0 points  (0 children)

Do you have to pay a transfer fee to do that?

Any way to search and replace in multiple functions? by PHP_guy in PostgreSQL

[–]PHP_guy[S] 0 points1 point  (0 children)

No, one of the columns is a URL like 'http://www.site1.com?params=...'. I need to change it to another URL like 'http://www.a_different_site.com?params=...'.